Customize text of `binary_sensor` on/off state

As far as I can tell, it’s only used for the icon image.

1 Like

Thanks; this makes sense and it’s been bugging me for awhile!

If that’s the case, that it only sets the icon image, maybe it could be extended to change the text too? If just the opening device class were expanded to include this visual text change it would be trivial for users to implement (or possibly completely transparent for them to implement if they’ve already implemented it for the icon change). It should probably not be more than just cosmetic though - if you setup an automation and base it on the condition of a binary sensor and use its alias, you’d want it to act accordingly as if you had used on/off instead. As long as open/closed was just a visual/cosmetic change, I imagine that would be fine.

Just some additional thoughts, I do like this idea. Has anyone started on this yet? Anything similar being considered?

Thanks!
-Chad

is there any final solution to this - just facing this myself

I too would love an official solution for this!

1 Like

This is the solution:

HI,

I managed to get the open / closed state by adding entry in customize.yaml for the sensor i want.

binary_sensor.sensor:
friendly_name: ‘Bedroom window’
sensor_class: opening
device_class: window

3 Likes

Hi,
I have à Fibaro door sensor V2. I have this configuration for this sensor:

Porte de garage

  • platform: template
    sensors:
    garage_door:
    device_class: garage_door
    friendly_name: “Porte de garage”
    value_template: >
    {% if states.sensor.capteur_garage_access_control.state == ‘22’ %}
    true
    {% elif states.sensor.capteur_garage_access_control.state >= ‘23’ %}
    false
    {% endif %}

I can only use ‘true’ and ‘false’ which display ‘Open/Closed’ on Front from HASS and ‘on / off’ value in the states from HASS. Other values than ‘true/false’ doesn’t work but I’m French and need to display state ‘Ouvert/Fermé’. Is it possible to customize the states ? In several posts from the forum they use ‘open/closed’ or ‘on/off’, also I don’t understand why I can only use values ‘true/false’. Does anyone have an explanation ? Thank you in advance for your answers.

Hello @Zigloo, I’m Frenn too and I would like to do the same things. Display “Ouvert” instead of Open and “Fermé” instaed of Close.

Did you find a solution?

We can speak in French in private if it’s easier for you.