Change Icon with State Change

Looks like it’s working. The state will only show open/closed in the UI, not on the states page

1 Like

Not sure about the icon though in the attributes list
Using device_class that shouldn’t be there?

No, device class doesn’t add the icon attribute, it’s all handled by the frontend.

So the issue here is why is it set ? And not changing upon state change…

We don’t know if he’s looking in the correct spot or restarting between each change. It’s working for me so it’s definitely something he is doing with his config.

1 Like

Agreed. It seems there’s a fixed customize on the icon somewhere overriding the device_class.

I finally figured it out! Sort of…
Just putting this in config.yaml didn’t work.

customize:
    binary_sensor.open_close_sensor_25_be_7e
      device_class: door

When I created a switch template it works, but not on an entity card, works fine on a glance card.

Thanks to all who helped. I will continue to search for why it doesn’t work with setting device_class.

right, thats indeed a known ‘issue’, entity card behaving differently on customizations compared to other cards.
In my custom-ui repo, there’s a warning on that: custom-ui/README.md at master · Mariusthvdb/custom-ui · GitHub

Always believed that to be an issue in the custom-ui plugin, and I hadn’t realized it didnt accept core customize on a core device_class either. I would say that is truly a bug.