Closed B0ndo2 closed 8 months ago
What integration gives you these entities?
Can you please paste the entity and its attributes (screenshot) from the Home Assistant Developer Tools?
I think that the reason why the battery level was not correctly recognized is that entity state contains the "%" which is not prefixed with space
Do you mean this ?
The card was working properly previously but stopped working after updating today (both the card and HA supervisor)
Can you please add to your config the following:
default_state_formatting: false
Please tell me if this helps and if so what is your locale settings in HA
That removed the question mark but all the icons now are green regardless of the threshold (I changed the 50% threshold to 60% to get a different colour)
I have some problem since last version, it was working with all colors according to value, now only battery icon with question mark
I have some problem since last version, it was working with all colors according to value, now only battery icon with question mark
Adding this in the card config fixed for me for the question mark but the colours are still the same for all levels default_state_formatting: false
The default_state_formatting: false
worked for me as well. My locale config is US/English/US customary.
Just noticed this as well. I'm on the February beta release though and thought it may be due to this:
https://developers.home-assistant.io/blog/2024/01/30/ha-state-icon-properties-changes/
same issue here since beta 2024.2 (Feb release)
I had the same problem (icon with a question mark and no color). "default_state_formatting: false" fixed both problems for me. It also fixed an issue with sorting. Without "default_state_formatting: false" the order was 100%,100%,17%,40%,69%,94% and with it is correct 17%,40%,69%,94%,100%,100%. Sounds to me as if the entity state (battery level) is interpreted as a string instead of a number and can therefore not be mapped to the right symbol and color or sorted correctly..
Yeah it fixed it for me too.
@midiwidi yes this is the exact problem. I have assumed that the formatted state which comes from HA will always be in the format of [value] [unit]
but it looks like the space is gone in many cases after 2024.2 release, now the logic fails to parse the returned state. I need to think whether this extraction of the state make sense... it has caused soooo many problems/bugs
@tomlut the change to ha-state-icon should not have any impact as this card uses ha-icon element only
Should be fixed now in v3.1.6
Icons show question mark and no colour
Expected behavior The icons should have colours based on battery level
YAML configuration
Version 3.1.5