Handling boolean sensors for state-icons in Picture Elements card?

Hello

I have a boolean sensor generated from a template sensor which monitors the status of a door. So basically it returns False when the door is closed and True when it’s open.

I’m trying to associate a state-icon for this entity in a picture elements card. All I want is the state-icon to change color when the Boolean sensor value changes, and I just can’t get this to work. It looks like the boolean status True does not get associated to a state like “active”, so the defined paper-item-icon-active-color never gets displayed.

What am I doing wrong ?

  - entity: sensor.door_living_room
    icon: 'mdi:lock'
    style:
      '--paper-item-icon-active-color': '#ff0000'
      '--paper-item-icon-color': '#333333'
      background-color: 'rgba(255, 255, 255, 0.3)'
      border-radius: 50%
      left: 63%
      top: 58%
    type: state-icon

You need to make a binary_sensor. Not a sensor.

Show the code you currently have for the sensor if you need help.

1 Like

Thanks. Indeed I created 2 new binary_sensors and now the picture elements updates correctly.