I’ve lost you.
I’ve discovered that the icon of a binary sensor can’t change when the state changes and when I’ve asked about the icon template you pointed me to the legacy and modern format, but maybe because I’m a newbie, I don’t know how to use the modern format.
The question is: how can I have an entity that changes the icon between valve-open to valve-closed based on a binary sensor?
THANKS!!!
Explanations have been already been provided (several times) in this topic. If they’re still unclear to you then I suggest you review the documentation (links posted above) while waiting until someone else volunteers to re-phrase the existing explanations.
I’ll hop on this discussion here. I have a diffuser integrated with localtuya. It has a binary_sensor that senses, if the water is empty. I’ve set the moist device class within localtuya. I included the water sensor state to a mini-humidifier card. Now I’m not happy with the shown states, that the different binary_sensordevice_classes provide. Moist is near, but it’s neither dry or wet. I want to use something more like fill level related.
Is there a way on reassigning the binary_sensor states with a customization? I tried
$ cat customize.yaml
[...]
binary_sensor.diffuser_needs_water_fault:
value_template: |
{% if states.binary_sensor.diffuser_needs_water_fault.state == 'off' %} ok
{% elif states.binary_sensor.diffuser_needs_water_fault.state == 'on' %} needs water
{% else %} unknown
{% endif %}
On my first guess I’d say this not possible? Sounds like some circular dependency by the customization. If’ this is correct, is there a best practice?
Sure, I could just define a second binary_sensor that uses the diffusor values. I’m just curious and it feels a little more clean to rewrite the states.
Another approach would be to just use a value template/mapper for the for the mini humidifier indicator…
No, binary sensors are purely on/off, and have device classes that alters how the UI shows that. You could do that with a standard template sensor though.