[SOLVED][0.103.3] Time triggers not firing

I’m struggling a bit with some automations. My sdcard died in my hass.io installation last week and I’ve had to recreate everything from scratch including all my automations I had setup.

I noticed that my automations that use a time trigger are not actually triggering. So I started with a very basic test. Using a time_pattern trigger, everything works fine, but trying to use a time trigger, it never shows triggered in the logbook.

Here is the one that is not working:

- alias: Testing Triggers
  trigger:
    platform: time
    at: '21:20:00'
  action:
    service_template: >
      light.turn_{% if is_state('light.guest_room_light_101', 'off') %}on{% else %}off{% endif %}
    entity_id: light.guest_room_light_101

Changing the platform to time_pattern like this makes it start working as expected:

- alias: Testing Triggers
  trigger:
    platform: time_pattern
    minutes: "/5"
  action:
    service_template: >
      light.turn_{% if is_state('light.guest_room_light_101', 'off') %}on{% else %}off{% endif %}
    entity_id: light.guest_room_light_101

I saw in another post here, someone asked for some time outputs in the template tester. Here is the input/output of that:

Input:
{{ now() }}
{{ utcnow().astimezone() }}
{{ now().astimezone() }}
{{ utcnow().tzinfo }}
{{ now().tzinfo }}
{{ now().astimezone().tzinfo }}

Output:
2019-12-21 05:35:00.567765+00:00
2019-12-20 21:35:00.567855-08:00
2019-12-20 21:35:00.568093-08:00
UTC
UTC
PST

Everything there is correct. I’m in the pacific time zone and that was the correct local time when I ran that test.

I’m running hass.io version 0.103.0 on a Raspberry Pi. Any ideas?

Try updating to 0.103.3

Yeah, let me try that right now. I looked at the release notes for 0.103.1, .2, and .3 but didn’t see anything related. But I was kind of thinking it might have something to do with it. I’ll report back after I upgrade.

I updated to 0.103.3 and I still have the same problem. The automation won’t trigger. It used to work on my old system before the sd card died. I had several automations that used a time trigger.

Ok, I figured out the problem. I have to specify the time in UTC, not my local time. I got fooled because the logbook and my system logs show the correct time.

I think what happened was the way I setup the system. Previously, there was no UI for setting your location, so all my info was in configuration.yaml. This time when I setup the system, I did it in the UI using the Configuration->General settings. I used the map to set my location. When I just looked at that again, I saw the timezone was set to UTC. It’s funny because as you can see in my first post, all the times were correct. Those were probably coming from the pi, I guess and not HA.

1 Like