Door state is on/off, not open closed?


I have two door sensors in zigbee.

I have set the device class to door in customize.

However it still sends state on and off, not open or closed?

How can this be solved?

1 Like

Can’t be solved. Binary sensors always have a state ‘on’ and ‘off’, the device class just sets the text in the front-end.

Read here for more info-

For door: on means open, off means closed. Open and closed are just translations in the frontend.

When you are configuring an automation, always refer to the actual state that are displayed in Developer Tools —> States (tab).

Just an example-

  - platform: state
    entity_id: binary_sensor.openclose_15
    to: 'on'
    from: 'off'

You can make a template sensor to display open/closed so you can display as you wish in lovelace. You can also use the sensor in automations but that seems silly.

#Make the sensor show Closed or Open
  - platform: template
        friendly_name: "1 Door Open-Closed"
        unique_id: "single_garage_door_open_closed_sensor"
        value_template: >-
          {% if is_state('binary_sensor.door1', 'off') %}
          {% elif is_state('binary_sensor.door1', 'on') %}
          {% endif %}

edit: -I cut out of my sensor.yaml file and didn’t add in the ‘sensor:’ to start