Query regarding wanted_time_after parameter

Hi all,

I have an automation to turn off some lights after sunset if no motion is detected, but its failing on the sunset time check with the below trace;

Executed: 27 September 2022 at 19:47:20
Result:

wanted_time_after: '2022-09-27T19:17:05.502395+00:00' result: false

Triggers and conditions for my automation are as follows

  trigger:
  - type: no_motion
    platform: device
    device_id: 0f7b60e0c0359967c32814f894168517
    entity_id: binary_sensor.hue_motion_sensor_1_motion_2
    domain: binary_sensor
    for:
      hours: 1
      minutes: 0
      seconds: 0
  condition:
  - condition: sun
    after: sunset
    after_offset: 01:30:00
    enabled: true
  - type: is_no_motion
    condition: device
    device_id: bb5be9313f880e6c31e40513ce09b565
    entity_id: binary_sensor.hue_motion_sensor_1_motion
    domain: binary_sensor
    for:
      hours: 0
      minutes: 0
      seconds: 1

My confusion is around the trace. Why is it failing even though the time is later than the wanted_time_after value?

Thanks in advance

It’s likely down to timezones… the Executed: time is in your local timezone, and wanted_time_after: is in UTC.

1 Like

Copy-paste the following template into the Template Editor and it will display wanted_time_after in your local timezone.

{{ '2022-09-27T19:17:05.502395+00:00' | as_datetime | as_local }}

Compare the displayed time to when the automation was executed (19:47:20).

1 Like

thank you!

thank you, didnt even know about the template editor, this is super useful

1 Like