Wintertime = "NOT Summertime" does not work

Hi,
I have the following in my configuration.yaml:

# trigger based sensors
  - trigger:
      - trigger: time_pattern
        # einmal in der Nacht reicht
        hours: "00"
        minutes: "06"
    binary_sensor:
      - name: "Sommerzeit"
        unique_id: "summer_time"
# Sommerzeit vom 25.3. bis 21.9.
        state: "{{ (3,25) <= (now().month, now().day) <= (9,21) }}"
  - trigger:
      - trigger: time_pattern
        # einmal in der Nacht reicht
        hours: "00"
        minutes: "07"
# Winterzeit = NICHT Sommerzeit
    binary_sensor:
      - name: "Winterzeit"
        unique_id: "winter_time"
        state: "{{ not is_state('input_boolean.sommerzeit','on') }}"

Which should test for Summertime (in my config between march 25 and sep 21) and set the sensor once a night at 00:06 and

set wintertime = NOT summertime

at 00:07. Today I saw, that summertime is correct, but wintertime is not. The whole winter, the wintertime booloean was correct. Where am I wrong with this small code snippet?

thank you
juergen

Replace input_boolean.sommerzeit

state: "{{ not is_state('input_boolean.sommerzeit','on') }}"

With binary_sensor.sommerzeit

state: "{{ not is_state('binary_sensor.sommerzeit','on') }}"
1 Like

Hi @123
Many thanks. One question:
I really tested this very thoroughly when I “programmed” it in wintertime. I also set the “summertime dates” during test, so that I got true/false. But for shure “wintertime” was always “true”, but due to a different case.
How can I test this, when I try things in HA? If I understand it correct, before I could have basically tested for “NOT cheeskake on my desk”, and also get a “true” for wintertime.

many thanks
Juergen

@123
Boah, me stupid Should have not been so happy,m that summertime changes, but should have also watched more carefully that wintertime does not change.
argh
sorry.

Jurgen

Stupid question… why two sensors…if binary_sensor is not summertime (off/false) …isn’t it then not automatically wintertime :slight_smile: ? Or do you live in a multiverse :slight_smile:

Hi @vingerha,
I use the booleans in “some” automations and find it easier to read, if I “play” with my “code”.

all the best
Juergen

Maybe helpfull, i use this to notify myself when daytime saving will be on the next day…

alias: "DTS changes"
description: Notify at 18h that DTS will change tomorrow
triggers:
  - at: "18:00:00"
    trigger: time
conditions:
  - condition: template
    value_template: "{{ currDST != nextDST }}"
actions:
  - data:
      title: >
        {{ 'Wintertime starts tomorrow' if currDST > nextDST else 'Summertime
        starts tomorrow' }}
      message: >
        {{ 'The clock will be set back one hour tonight' if currDST > nextDST
        else
           'The clock will advance one hour tonight' }}
    action: notify.mobile_myphone
mode: single
variables:
  currDST: "{{ now().timetuple().tm_isdst }}"
  nextDST: "{{ (now()+timedelta(days=1)).timetuple().tm_isdst }}"

This will trigger at 18:00 when currDST (today) != nextDST (tomorrow)