Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change ICON based on SENSOR state #1736

Open
edwardtfn opened this issue Jan 25, 2024 · 4 comments
Open

Change ICON based on SENSOR state #1736

edwardtfn opened this issue Jan 25, 2024 · 4 comments
Labels
Enhancement For suggestions that add new features or improve existing functionalities.

Comments

@edwardtfn
Copy link
Collaborator

Please could we have an option to change an ICON/ICON-COLOR based on a SENSOR state?

ICON EXAMPLE:
icon: |- [[[ if(states['sensor.<BLAH-alarm_entity-BLAH>'].state == 'Disarmed') return "mdi:alarm-light-off"; else if(states['<BLAH-alarm_entity-BLAH>'].state == 'Away Armed') return "mdi:alarm-light"; ]]]

Originally posted by @AubreyKloppers in #1183

@edwardtfn edwardtfn added the Enhancement For suggestions that add new features or improve existing functionalities. label Jan 25, 2024
@edwardtfn
Copy link
Collaborator Author

@NdS-Research-Facilities
Copy link

you can do things like this in the yaml config.
chip05_icon_color: "{{ state_attr('sensor.afvalwijzer_tomorrow_color', 'kleur')}}"

@edwardtfn
Copy link
Collaborator Author

This will most likely work (I haven't tried myself), however you have a big chance to have issues when using the UI to change settings in your automation, as that will probably overlap it's settings.
Also, on the blueprint there's no trigger for the attribute changing (with rare exceptions). If the state of that entity changes, then the attributes will be updated, but if only attributes changed, you have a chance to not get the icon updated.
This is how it is now.

@lizznl
Copy link

lizznl commented Dec 16, 2024

you can do things like this in the yaml config. chip05_icon_color: "{{ state_attr('sensor.afvalwijzer_tomorrow_color', 'kleur')}}"

Hi @NdS-Research-Facilities @edwardtfn I'm affraid it doesn't work indeed. The template sensor does get change on true/false but the color attribute stays the same color on the NSP device.

Is there a workaround to force the color refresh of the icon aswell? When you disconnect the NSP from power, the color does get retrieved correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For suggestions that add new features or improve existing functionalities.
Projects
None yet
Development

No branches or pull requests

3 participants