Time zone issue with input_datetime

Hi

The set input is triggering at the wrong time.
I’ve read some threads here, but did not reached a solution. I hope I didn’t miss something.

My setup:

I have a time sensor

sensor:
  - platform: time_date
    display_options:
      - 'time'

And an automation script (which uses the ‘true’ in the template’s time stamp comparison)

- id: '1587744513372'
 alias: 'power on on time '
 description: ''
 trigger:
   platform: template
   value_template: "{{ states('sensor.time') == (state_attr('input_datetime.amit_s_light', 'timestamp') | int | timestamp_custom('%H:%M', True)) }}"
 action:
 - device_id: bc37ba8b5a0c49e690fb1a1e11eb9c49
   domain: light
   entity_id: light.desk_lamp
   type: turn_on

I have set my local time zone and geographical location
I see the “correct” time on the home assistant overview page, however, the set time in the input_datetime is triggered 2 hours after the expected time (i.e. if I want to get the trigger at 11:00, I have to set it to 9:00)
I’m living at UTC+2 (which might fit the 2 hours difference) however currently we are at UTC+2+DST, a 3 hours difference from UTC.
I’ve checked the automation itself and the action is working when triggered manually.

Any ideas? further debug steps? I’m newbie here and doesn’t have a debug environment on my computer.

Thanks
Ariel

Try:

...timestamp_custom('%H:%M', False))
1 Like

Wow Tom

Worked like charm!
I thought it should be true, for local_time = true
Silly me I didn’t try it earlier.

Thanks
Ariel

There’s a great explanation as to why here:

1 Like

Or as sensor time is always local you can ignore time stamps completely

value_template: "{{ states('sensor.time') == states('input_datetime.id_switch_h1_tmeslt1_off') [0:5] }}"