How to change icon on glance based on state

i couldn’t find a guide on how to change the icon but i found how to change image
but it doesn’t work :frowning:

here’s my code


also state_filter what i understand it should only show entities which is on only, right?

Try lowercase on and off. Normally states are lowercase and it just shows uppercase in the frontend.

unfortunately it didn’t fix it :cry:

do you have a glance card where you have tried the state_icon you could share?

I don’t have an example for a glances card. I set the icon through customization, this way I only need to set it once and it will be correct in every card I use it.

For the sensors you have, the device class should be sufficient to show the correct icons. In customize.yaml I have for example

binary_sensor.fenster_wohnzimmer:
  friendly_name: Fenster Wohnzimmer
  device_class: window

According to the documentation of Glance card, it is not possible to use a “state_icon” variable.

You have to use something like this: 📝 100% Templatable Lovelace Configurations