I recently ran into an issue where my ‘time’ automatons would fail to trigger or trigger very late. I sometimes find that a time trigger will actually trigger at the correct time but then another set for the same time won’t - using ‘time’ triggers have been increasingly unreliable.
I’ve searched the blogs and have not seen anyone else experiencing the same problem recently. I’ve also don’t know which version of hass when my ‘time’ triggers started failing. I’ve also checked my settings, configurations and code but have not stumbled on to anything obvious. I do have a workaround by using sensor.time and a state trigger but I think that’s not an elegant solution. I am looking for some thoughts on this before I escalate to reporting this since I haven’t seen this being discussed on this forum or in the bug reports.
Here goes…
I am running HA 2021.4.6 on a VM ubuntu 16.04.7 LTS.
I’ve created 5 automation time triggers to demonstrate the issue:
(I’ve used various " and ’ around the time but get the same results below.)
- id: '123451'
alias: Test timer 1
initial_state: 'on'
mode: single
trigger:
- platform: time
at: "06:00:00"
condition: []
action:
- service: persistent_notification.create
data_template:
title: Test timer
message: Test timer 1 executed. {{ now().strftime('%H:%M %Y-%m-%d') }}
- id: '123452'
alias: Test timer 2
trigger:
- platform: time_pattern
hours: 6
minutes: 1
seconds: 0
condition: []
action:
- service: persistent_notification.create
data_template:
title: Test timer
message: Test Timer 2 executed. {{ now().strftime('%H:%M %Y-%m-%d') }}
initial_state: 'on'
mode: single
- id: '123453'
alias: Test timer 3
initial_state: 'on'
mode: single
trigger:
- platform: state
entity_id: sensor.time
to: "06:00"
condition: []
action:
- service: persistent_notification.create
data_template:
title: Test timer
message: Test Timer 3 executed. {{ now().strftime('%H:%M %Y-%m-%d') }}
- id: '123454'
alias: Test timer 4
initial_state: 'on'
mode: single
trigger:
- platform: time
at: "04:00:00"
condition: []
action:
- service: persistent_notification.create
data_template:
title: Test timer
message: Test timer 4 executed. {{ now().strftime('%H:%M %Y-%m-%d') }}
- id: '123455'
alias: Test timer 5
trigger:
- platform: time_pattern
hours: 4
minutes: 1
seconds: '0'
condition: []
action:
- service: persistent_notification.create
data_template:
title: Test timer
message: Test Timer 5 executed. {{ now().strftime('%H:%M %Y-%m-%d') }}
initial_state: 'on'
mode: single
I’ve ensure that my timezone is set correctly (see above for configuration) and use Dev Tools Template to verify the output.
Now - all 5 timer triggers work but only 1 is correct - Timer 3 uses ‘sensor.time’ and is a ‘state’ trigger. I tried to trigger them all at ‘06:00:00’ (and :06:01:00) and as you can see, it appears to be a random offset from the actual time requested.
Any thoughts on this would be appreciated.
thanks.