I just got 2 z-wave door sensors. In my configuration I customized them to be opening
type sensor_class
.
# doors
binary_sensor.ecolink_doorwindow_sensor_sensor_5:
friendly_name: 'Side Door'
sensor_class: opening
binary_sensor.ecolink_doorwindow_sensor_sensor_6:
friendly_name: 'Front Door'
sensor_class: opening
I can then add them directly to my frontend in a group.
Doors:
- binary_sensor.ecolink_doorwindow_sensor_sensor_6
- binary_sensor.ecolink_doorwindow_sensor_sensor_5
And that looks like this:
But, if I want to display Open/Closed instead of On/Off, I have to create a sensor
template. I’ve done this for my garage door for example.
sensor:
platform: template
sensors:
garage_door:
value_template: >-
{% if states.binary_sensor.ecolink_garage_door_sensor_sensor_3.state == 'on' %}
Open
{% elif states.binary_sensor.ecolink_garage_door_sensor_sensor_3.state == 'off' %}
Closed
{% else %}
n/a
{% endif %}
And the customization for the garage door:
sensor.garage_door:
friendly_name: 'Garage'
icon: mdi:glassdoor
And that looks like this:
However, because this is now a sensor
and not a binary_sensor
, you can’t set the sensor_class
and it will no longer use an icon that changes based on the state of the sensor.
I think it would be neat to be able to customize the text displayed for on/off states of binary_sensor
's.
You could handle this in customize possibly, like so:
# doors
binary_sensor.ecolink_doorwindow_sensor_sensor_5:
friendly_name: 'Side Door'
sensor_class: opening
alias_on: 'Open'
alias_off: 'Closed'
binary_sensor.ecolink_doorwindow_sensor_sensor_6:
friendly_name: 'Front Door'
sensor_class: opening
alias_on: 'Open'
alias_off: 'Closed'
And then that would get you something like this in the frontend: