I have the following logic that evaluates to on in Developer Tools > Template. However HASS evaluates it as off when set as a binary sensor. What have I missed?
- platform: template
sensors:
bedroom_aircon_needed_on:
value_template: >-
{% if ((states.sensor.bom_perth_air_temp_c | float) < 20) and ((states.sensor.temperature_158d0001fd8502 | float) < 18) %}
on
{% elif (( states.sensor.bom_perth_air_temp_c | float) > 20) and ((states.sensor.temperature_158d0001fd8502 | float) > 24) %}
on
{% else %}
off
{% endif %}