maxwroc / battery-state-card

Battery state card for Home Assistant
MIT License
851 stars 38 forks source link

Bulk include not working for 1/3 of my devices #739

Open DonLuigi opened 2 weeks ago

DonLuigi commented 2 weeks ago

Describe the bug To bulk include devices, you would typically write filter: include:

However, I have many devices that have battery low state attribute classified as device_class: battery. This means that instead of displaying battery percentage, the card displays On or Off, and no battery percentage, since it includes only one (first) attribute of the entity that matches.

Since there is no AND in include, I cannot write something like this: filter: include:

that would actually filter my entity attributes properly.

Is there any way around this?

GeoffWy commented 1 week ago

If your problem devices had battery percentage classified as device_class battery, that would display as well as battery low state.

It could be that those devices only offer battery state (values 0, 1, 2), in which case you could use state_map: to map those states to artificial percentages (eg, 25%, 50%, 100%).

Or it could be that the battery percentage for these devices is being classified as device_class measurement. You should be able to find some other filter method to include them, and use an exclude: to exclude the battery state you don't want. Alternatively maybe you can you use the attribute: option to pick out the attribute you want. Also suggest use the debug: option to inspect what is actually available.

All these options are described here.