I’m trying to get a binary template sensor working but I have some problems.
Can you see any errors below?
- platform: template
sensors:
dishwasher:
friendly_name: "dishwasher"
delay_off:
minutes: 3
value_template: >-
{% if states('sensor.dishwasher_power')|float > 2 %}
on
{% elif states('sensor.dishwasher_power')|float < 1 %}
off
{% endif %}
The sensor state never change to “on” even if sensor.dishwasher_power is over 2. I have tested the value template in “Developer tools” and it works there.
The main problem is you’re using on instead of true. A secondary problem is the value_template has no value if sensor.dishwasher_power is between 1 and 2.
Will the binary sensor change from true or false if sensor.dishwasher_power is between 1 and 2? If it retain the previous value in that occasion I guess it will work anyway.
The problem with the threshold sensor is that it has no delay_off parameter.