Sensor doesn't switch correctly at 20:00 in the evening

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

(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:

1 Like