Closed T-h-o-m-a-s closed 6 months ago
Yes, I have noticed this happen as well. I have noticed that if some entities have the particular attribute but others do not, the ones that do not have that attribute have the value "undefinedundefinedundefined" in the column.
type: custom:auto-entities
filter:
include:
- domain: device_tracker
attributes:
source_type: router
not:
state: home
exclude: []
card:
type: custom:flex-table-card
title: Offline Devices
columns:
- data: ip
name: IP
clickable: true
did you try setting strict: true
? the "undefined" stuff is kind of expected behavior, if you would like to filter them out, just take a look at strict
: https://github.com/custom-cards/flex-table-card/blob/master/docs/example-cfg-sorting-strict.md
Does anybody know a different fix than setting strict: true
?
I have e.g. climate devices that contain data from different sources and if one is unavailable (e.g. the humidity sensor) none of the available data is shown.
Here an example:
As you can see, some information is available.
Would a semi-strict
option be possible? I.e. hide only the undefined data but show the rest?
@AleXSR700
I have e.g. climate devices that contain data from different sources and if one is unavailable (e.g. the humidity sensor) none of the available data is shown.
For simplicity: in flex-table-card one row = one entity (let's not speak about complex structures like arrays).
If some attribute is missing - either the whole row will be not shown (strict: true
) or just this cell is "undefined" (strict: false
).
The "undefined" cells (as you know) may be processed by "modify" like this:
type: custom:flex-table-card
entities:
include:
- sensor.xiaomi_cg_1
columns:
- name: CO2
data: co2
- name: PM2.5
data: state
- name: xxx
data: xxx
- name: yyy
data: yyy
modify: |-
if(x.length == 0) {
"-"
} else {
x
}
strict: false
I.e. hide only the undefined data but show the rest?
How do you imagine that? There are 3 rows, 5 columns. The 2nd row has a missing 3rd cell - then will the row contain only 4 cells? Probably you still want to show 5 cells - with an empty 3rd cell. This may be processed as described above.
@daringer I wonder why this issue is still open. Displaying "undefined" is an expected behaviour; there are ways to process these values.
Yes, you are correct. I found the workaround later. I would still consider it a kind of a bug or maybe more of an option oversight. But since the card itself allows the workaround, it is just a feature request to make the workaround superfluous :)
Plus: why is "undefined" written 3 times? That is an actual bug :D
Plus: why is "undefined" written 3 times? That is an actual bug :D
given the next-to-non-existing-impact of this troublesome bug, I'll just (re-)define this behavior as a feature :D
@daringer I wonder why this issue is still open. Displaying "undefined" is an expected behaviour; there are ways to process these values.
valid point, closing
Don´t know if it is a bug, or me not able to figure out how to exclude entities with null in one of the attributes. I have a card displaying all my plant sensors states in a table. Has been working great. Until now, when a few sensors happen to have empty/null value in the "conductivity" attribute. This makes the whole table become empty and only the headers show.
ATTRIBUTE COLUMN IN DEVELOPER TOOLS/STATES:
problem: moisture low sensors: moisture: sensor.mi_flora_13_moisture battery: sensor.mi_flora_13_battery temperature: sensor.mi_flora_13_temperature conductivity: sensor.mi_flora_13_conductivity brightness: sensor.mi_flora_13_luminance
unit_of_measurement_dict: temperature: °C brightness: lx moisture: '%' battery: '%'
moisture: 1 battery: 86 temperature: 18.8 conductivity: null brightness: 143 max_brightness: 143 friendly_name: S Dracaena