Help with door value template

I am trying to get some entities to report a differently worded status, but doing something wrong.
My door is open, but the new template reports it as closed.

image

      basementdoor:
        friendly_name: "Basement Door Status"
        device_class: door
        value_template: '{%if states.binary_sensor.ecolink_door_window_sensor_sensor_2Basement == "on"%}Open{%else%}Closed{%endif%}'

Is that a binary_sensor or sensor?

Binary sensors are purely on/off, you can’t set text states for them.

They are binary sensors for door contacts. Is there no way to get them to report a different status?

just change the device class of that binary_sensor to door and the UI will read open/closed. Do that in the customization section.

homeassistant:
  customize:
    binary_sensor.ecolink_door_window_sensor_sensor_2Basement:
      device_class: door

You’ll still need to use on/off for your automations, but the UI will display open/closed and the Icon should reflect the state.

EDIT: You can also do this through the UI.

Through the lovelace card?

no through configuration > customization

Ahhh, tyvm.

1 Like