Time-based automations trigger with delay (2–20 min) – diagnostics and ideas needed

Hi everyone,

I’m facing a strange issue with my Home Assistant setup, and despite trying a number of things, I haven’t been able to solve it. I’m hoping someone here might have an idea.

The problem:

I have automations that are triggered based on specific times – using both time and time_pattern triggers.

Recently, these time-based automations stopped triggering on time. Instead, they fire with a delay of anywhere between 2 and 20 minutes (seemingly random). I only noticed this after the fact, so unfortunately I can’t pinpoint exactly when it started (the logbook is deleted after 10 days).

Here’s an example of a time-based trigger that fired 8 minutes and 41 seconds late (intended time was 05:30):

this:
  entity_id: automation.umwaelzpumpe_steuerung
  state: 'on'
  attributes:
    id: '1709320602196'
    last_triggered: '2025-05-15T16:35:03.008290+00:00'
    ...
trigger:
  platform: time
  now: '2025-05-16T05:38:41.410456+02:00'

What I’ve already tried:

  • Restarted the system multiple times
  • Verified system time – now() reports correct time, also confirmed with date via SSH
  • checkef if NTP sync is working - works
  • Migrated HA from Raspberry Pi 4 to a Proxmox VM using backup & restore (problem existed before and after the migration)
  • Installed Chrony additionaly to rule out time sync issues
  • Tried a workaround from this 2-year-old community post – no luck
  • Disabled all but one automation to rule out interference
  • Rebooted in Safe Mode – no improvement
  • Switched some triggers to use template-based triggers like {{ states('sensor.time') == '05:30' }} – slightly better, but still a 1–2 second delay

To eliminate the VM environment as the cause, I even set up a second clean HA instance in a VM with no integrations and just a minimal automation (send a notification at specific times using time and time_pattern triggers). This worked perfectly – triggers fired exactly on time.

So it seems like something is broken in my main system regarding time-based triggers.

Unfortunately, my backups don’t go back far enough to before the issue started (I noticed it too late – my bad for not keeping more history).


My questions:

  1. Do you have any further ideas on how to diagnose or repair this issue? Like disabling something,… etc
  2. Alternatively, how could I rebuild my HA instance from scratch without losing everything? I’d especially like to keep historical energy data, which is very important to me.

Any ideas or tips would be greatly appreciated!

Thanks so much,
braigster

What is the automation?

That is not bad at all.
I don’t think my timed automations trigger exactly either.

These did:


These did not:



I don’t expect my timed automations to trigger exactly.

Thanks for your reply.

The automatio code currently looks like this:

alias: Umwaelzpumpe Steuerung
description: ""
triggers:
  - event_type: timer.finished
    event_data:
      entity_id: timer.umwaelzpumpe_timer
    id: pumpe aus
    trigger: event
  - trigger: template
    value_template: "{{ states('sensor.time') == '05:30' }}"
    alias: 0530 als Template
  - at: "07:30:00"
    trigger: time
  - trigger: time
    at: "11:30:00"
  - at: "16:00:00"
    trigger: time
  - alias: 1800 als Template
    trigger: template
    value_template: "{{ states('sensor.time') == '18:00' }}"
conditions: []
actions:
  - if:
      - condition: trigger
        id:
          - pumpe aus
    then:
      - type: turn_off
        device_id: cc6ea9c06d6f4094d690b2711a6d0b80
        entity_id: d82bd547250c0d38e3dc49f1825bdb8a
        domain: switch
    else:
      - metadata: {}
        data: {}
        target:
          entity_id: timer.umwaelzpumpe_timer
        action: timer.start
      - type: turn_on
        device_id: cc6ea9c06d6f4094d690b2711a6d0b80
        entity_id: d82bd547250c0d38e3dc49f1825bdb8a
        domain: switch
mode: single

As you can see, i already replaced some by template-based triggers… they work kind of fine…(but still not completely acurate)

So you mean i should just replace all with template-based and don’t try to fix the time based stuff?

No… Not sure…
It would of course be good to fix it.
But what about ruling out the pump?
What happens if you duplicate the automation and replace the pump with an helper boolean, will this make it work?

But in the mean time you could make one template trigger with all the times.

{{ states('sensor.time') in ["05:30", "07:30", "11:30", "16:00", "18:00"] }}

Oh and also try and remove the device actions and make them switch.turn_on /off instead.
It shouldn’t be the reason but let’s try it all

Ok, I changed it! Let’s see

Thanks a lot for your help — I really appreciate it!
I actually tested something similar just some days aso: just a new, simple, time-based automation triggering a notification — and even that one shows the delay.
So it doesn’t seem related to the device itself, unfortunately. Several automations are affected (but i did not post the yaml for all of them, to keep it simple) :frowning:

Got it.

Well the best patch I can give you is the template.
You could also have another template that would react to if the switch was not turned on between 5:30 and 6:00 and make another try.

But I don’t have the skills to help you with the actual problem.

1 Like

Thanks anyways!

I think this would only workaround the problem :smiley: I really want to resolve the timing issues…