I’m trying to create a binary sensor that tells me if my clothes dryer is on/off based on power consumption. I’ve tested the following template code in the Developer Tools, and it correctly reports the value:
{% set power = states('sensor.sonoff_s31_06_power') | float %}
{% if power > 10 %}
'On'
{% else %}
'Off'
{% endif %}
However, if I use the same code inside a binary sensor helper, it always reports ‘Off’ whether the dryer is running or not:
Am I templating this incorrectly?