Hello, I have created a binary sensor which should indicate when my power provider offers cheaper kWh.
My sensor is configured as follows
eco_kwh:
friendly_name: "Eco kWh"
value_template: >
{% if (now().month >= 5 and now().month < 11) and (now().hour >= 23 or now().hour <= 7) %}
on
{% elif (now().month >= 11 or now().month <= 4 ) and ((now().hour >= 2 and now().hour <= 8) or (now().hour >= 15 and now().hour <= 17)) %}
on
{% else %}
off
{% endif %}
The result of the above is a bit weird. The sensor turns on at the correct time but turns off one hour later that it should.
Any ideas? Am I missing something obvious?