Time trigger automatons fail to trigger timely

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.
Timer3

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.

Timer2

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.

Timers

Any thoughts on this would be appreciated.

thanks.

1 Like

@mahk8 has resolution on this issue? I am also experiencing the something. Another user @cor-vo also is experiencing this issue here.

Hello, I know this post is old but I have also been having this issue of time-based automations triggering late and found other forum posts of people reporting the same issue - Here’s a link to the relevant gh issue made for this. I thought I’d post the fix for this issue here since this post still comes up on google searches when searching for the issue:

The issue comes down to the “paravirtualization” option in VirtualBox. If you’re using VirtualBox’s GUI, go to System > Acceleration > Paravirtualization Interface and set it to None. Alternatively if you set it up on a headless system via the vboxmanage CLI tool then run the following command to disable the feature:

$ vboxmanage modifyvm hass --paravirtprovider none

Once you restart the machine your time triggered automations should be triggering when they’re supposed to. Hope this helps somebody and have a good day!

2 Likes

Thank you for sharing the workaround.

I just ran into this with a time-based automation this morning that failed to run as scheduled. Applied the workaround in VirtualBox, restarted, and so far the test time automations I set up seem to be working perfectly.

We’ll see if the original automation works this time.

Wanted to follow up since it turned out mine was not a problem with the time-based automation (or at a minimum, that wasn’t the only cause), as my automation still did not work properly even after that, the automation that was failing still did not work.

Turned out that the issue was that I had a condition that was failing due to an incorrect type (I was checking whether the temperature was below a certain threshold, and had used a state condition type rather than numeric state). Once I corrected the type, the automation ran fine.

So, a reminder not to be a dummy like me, and always test the simplest possible automation to eliminate stuff like that. :smiley: