Icon_template

Hi all,

is this valid in a glance / entity (because it’s not working :D):

  - badges: []
    cards:
      - entity: weather.sunnysix
        type: weather-forecast
      - title: Türen & Fenster
        type: glance
        entities:
          - entity: binary_sensor.blub_state
            icon_template: >
              {% if is_state("binary_sensor.blub_state", "on") %}
                mdi:door-open
              {% else %}
                mdi:door-closed
              {% endif %}          
          - entity: binary_sensor.blib_state
          - entity: binary_sensor.bla_state

or do I have to create a sensor through the sensor_template to get that done?

Kind regards,
Thomas

Hi tom,

It’s not withdrawn, I’m just waiting patiently if somebody has an answer :slight_smile:

Kind regards,
Thomas

FWIW, there’s a Feature Request to add the ability to set the icon based on the state:

1 Like

you have a binary sensor. Just customize the device class for that item and the icon will change based on the state.

homeassistant:
  customize:
    binary_sensor.bulb_state:
      device_class: door
1 Like

Works like a charm! :slight_smile: