Colorize custom badge-icon

Hey there,

I´ve created a sensor template for a shutter:

  - platform: template
        value_template: '{% if(states.cover.KEQ0879052.attributes.current_position > 0) %} offen {% else %} zu {% endif %}'
        friendly_name: 'WZ vorn'

I´d like to colorize or switch an icon instead of using the strings “offen” or “zu”.

I know I can add an custm icon, but this icon does not change the color if the state/level changes.

Is there a possibility to do this? The cover Icon in a group works great, but how could i get the same mechanism to the badge?

Greetings Dominic

Hi @Nic0205, you can use the device class of a binary sensor to change the icon, but not the color.

Hi @VDRainer
thank you for replying.

Changing the icon would last for me, but if I use the binary sensor, then there are a lot of device classes, but none for roller shutters - or am I missing something?


Nobody here who had the same problem?

You can change the icon in a template_sensor:
Sorry, missed that in my first post.

@VDRainer thanks again.

I tried it but in the badge appears just the Text and no Icon at all?

Am i doing something wrong?

Seems like this doesn’t work for badges, only for grouped sensors on cards.