Closed DreadN closed 10 months ago
yes, this is clearly a limitation currently. But you might use modify
to descent into the lists and select the next unique identifier, roughly like this:
columns:
- name: "1st Alert"
data: active_faults
modify: x[0].faultType
- name: "2nd Alert"
data: active_faults
modify: x[1].faultType
Unfortunately it doesn't work as intended, because when there's no fault, the array under "active_faults" is empty, and the "modify:" statements throws error.
But I appreciate the suggestion.
Main problem is from EvoHome integration that is not well structured and has too many nested information instead of having plain attributes or sensors.
Thanks.
well modify:
is in fact java-script code, which means could do arbitrary complex stuff and reformat your data as you wish...
something simple would be e.g.,:
modify: (x.isArray() && x.length > 0) ? x.map( (item) => `${item['faultType']} ${item['since']}` ).join("<br />") : "no failures"
(untested, be careful) but this would write all faults separated by a linebreak into one cell, but if the array is empty, simple report this... You could also check the project's (closed) ticket history, there have been ppl with multi-line js-code... in theory that's clearly possible, but I fully understand that this is by far not comfortable, nor something for everyone...
Yes, this clearly (again) increases the need for a json-per-column-selector within flex-table-card
Trying to visualize the "faultType" or also "Since" attribute in this entity. But nothing is visualized, even if i put comma between same value two times.
If i put this in data:
Result is: "null, null"
If i put this in fata:
Result is: "undefined"
Entity data: