Good day All,
Coud you please help me to configure binary_sensor tempale to remane state.
I can’t found any solution, that why I was forced to write this topic.
For the sensor it works, but for binary_sensor not.
Good day All,
Coud you please help me to configure binary_sensor tempale to remane state.
I can’t found any solution, that why I was forced to write this topic.
For the sensor it works, but for binary_sensor not.
Please follow Questions Guidelines #14 & 11 by posting configuration as properly formatted text, not screenshots.
The actual state of all binary sensors if “on” or “off”, no other options are allowed. The frontend representation of those states can be other preassigned values. That representation is assigned based on the device class. You can change your binary sensor to any of the available device classes if you prefer its frontend representation, but you cannot customize the value in any other way.
If you want the state to be something different than “on/off” you will need to use a sensor instead of a binary sensor.
I think I didn’t clearly explained my problem.
I have put device_class: door for my binary_sensor and state by defoult is Open and Closed, i just what to rename that state name to different.
For below sensor i did it and state name changed, but i can’t change it for binary_sensor
I think you explained well, but the answer is: besides choosing another device_class, you have little control over what is displayed for binary sensors.
As explained: Internally the state for binary sensors always on or off. The device class changes the displayed words in the user interface to what is in the documentation that was linked to. For a door, that is Open and Closed. Home Assistant then translates thos words using the built in translations to your language. But the translations are not for you to choose. So what is shown is not a “default”, it is what it is and you cannot pick anything else. You can only pick another (existing) device class.
The other sensor you made is a text sensor, where you choose whatever text you want as the state in the template. You could create a text sensor to display any words you want. In that case the state is exactly these words, and that means it is no longer a binary sensor. But it might not matter for you that it isn’t a binary sensor.
Thank you for your detailed answer.
Can I then ask another question in this same topic about sensor template?
I have below configurations for sensor in template configuration.
everything is working fine here ( animated icon and state rename, but i can’t configure value template for icon color. like on - yellow off - white
Well, that is one of the advantages of binary sensors, that Home Assistant has a color for on and off (also chosen by HA and not configurable built in).
Home Assistant has no built in support for icon colors on regular sensors. You need custom front end components for that. Either card mod or other cards that provide support. If you search the forum there are many topics on it.
Thx a lot. i did by
entity_picture_template: >-
{% if is_state(‘binary_sensor.dver_prikhozhaia_contact’, ‘on’) %}
/local/icons/door-open-orange.png
{% else %}
/local/icons/door-closed-white.png
{% endif %}