Icon update seems kind of delayed
Describe the bug I use customui for updating my icon/icon_color of my window states (bevause ha has strange window icons). However the icon and icon color only update sometimes when state changes, which leads to wrong icon and icon color displayed. Reloading the website however resets the icon to the correct state.
Configuration in Yaml
binary_sensor.zigbee_turkontakt_1_contact: &window_icon
device_class: window
templates:
icon: >
if (state == 'on') return 'mdi:window-open-variant';
return 'mdi:window-closed-variant';
icon_color: >
if (state == 'off') return 'steelblue';
if (state == 'on') return '#FFBF00';
if (state == 'unavailable') return 'grey';
if (state == 'unknown') return 'red';
return 'yellow';
Expected behavior Icon/Icon_color updating whenever state is updating
please take out device_class, as the only thing that does is set an icon depending on state.
can't have 2 captains on a ship..
also, a binary can only have 4 states, not five, so you could change the icon_color template to use that for the 'red'.
@Mariusthvdb thx for the correction, I now got:
binary_sensor.zigbee_turkontakt_1_contact: &window_icon
templates:
icon: >
if (state == 'on') return 'mdi:window-open-variant';
return 'mdi:window-closed-variant';
icon_color: >
if (state == 'off') return 'steelblue';
if (state == 'on') return '#FFBF00';
if (state == 'unavailable') return 'grey';
return 'red';
Problem however still exists. The icon do change most of the time but sometimes not (especially the first time after a longer time where nothing changed).
If the state hasn't changed the icon shouldn't change either?
Not sure I understand the issue you raise in that case
Unless: what card are you using to show the entities? Be sure to read the explanation about support for various cards, not all cards are supported
The entities are rendered like: popup card -> vertical stack card -> glance card
If I don't change the the icon only the icon color everything works as expected. I just get those weird us style windows.
Yes, if the state doesn't changed the icon doesn't change either. The icon just doesn't always change if the state does. Also icon and icon color are always matching (So it seems something related to template updating) For clarification here is an example situation:
sensor false icon closed
sensor true icon closed # Wrong, should change
sensor false icons open # Did change, but wrong icon
sensor true icon closed
Now the icon and sensor are flipped, very rarely the icons doesn't flip again and everything is correct. Reloading the site resets the icon in the correct state (independently of the state of the sensor).
I am using latest homeassitant 2024.5.
Ok I did some more testing. The problem seems to be specific related to the browser mod popup card.
I fear that is beyond my options to help you, as I dont use that card, so I can not test run it.
it would help, if you could simply test it in a core entities card, and confirm, that does do what you expect it to do.
I could then add a mention of the browser_mod popup to the documentation nt being supported, though it is a bit of a surprise to me, as the core glance card works just fine
also, please add the yaml for the config that does not work... its rule # 1 : help us help you by providing correct info in the correct format
Ok I did some more testing. The problem seems to be specific related to the browser mod popup card.
closing as this seems to be an issue with other plugin.
@Mariusthvdb sorry for not response! I did solve the issue by not using the browser mod popup card.