Hello everyone, does anyone have an idea why the sensor doesn’t switch correctly at 20:00 in the evening. It doesn’t change until 21:00!
sensors:
aew_comfort_verbrauch:
friendly_name: "AEW Comfort Verbrauch CHF kWh"
unit_of_measurement: CHF/kWh
value_template: >
{% set tariff = { "HT": 0.3665, "LT": 0.3197 } %}
{% if (now().weekday() < 5 and (7 <= now().hour <= 20)) or (now().weekday() == 5 and (7 <= now().hour <= 13)) %}
{{ tariff.HT }}
{% else %}
{{ tariff.LT }}
{% endif %}
![image](https://community-assets.home-assistant.io/original/4X/0/3/7/03774fbf847153160a5c185faed787833e56f7b5.png)
Troon
(Troon)
2
(7 <= now().hour <= 20)
is true up to and including 20:59:59.
1 Like
I’m stupid, it’s logical… Thanks for the help ![:slight_smile: :slight_smile:](https://community.home-assistant.io/images/emoji/twitter/slight_smile.png?v=12)
1 Like