Automation running twice

For some reason one of my automations seems to have a ghost copy which is an older version of the current automation that runs. When I check the logs the trace still links to automation with the newer settings. Even when I disable the automation the ghost copy of it still triggers.

alias: "Computer: Notify when program is idle"
description: ""
  - platform: template
    value_template: |-
      {% if states('sensor.bedroom_pc_last_active') != 'unavailable' %}
        not (
        states('sensor.bedroom_pc_active_window') == 'Steam' or
        states('sensor.bedroom_pc_active_window') == 'JDownloader 2' or
        states('sensor.bedroom_pc_active_window') == 'VirtualHere Client' or
        states('sensor.bedroom_pc_active_window') == 'File Explorer' or
        states('sensor.bedroom_pc_active_window') == 'Task Manager' or
        'Google Chrome' in states('sensor.bedroom_pc_active_window')
        ) and
        (now() - timedelta(minutes=60) > as_datetime(states('sensor.bedroom_pc_last_active')).astimezone())
      {% endif %}
condition: []
  - service: notify.mobile_app_joe_s20
      message: "{{ states('sensor.bedroom_pc_active_window') }} has been left idle."
      title: Bedroom PC
        sticky: "true"
        notification_icon: mdi:alert
          - action: notify_alf
            title: Notify Alf
          - action: close
            title: Ignore
  - wait_for_trigger:
      - platform: event
        event_type: mobile_app_notification_action
          action: notify_alf
      - platform: event
        event_type: mobile_app_notification_action
          action: close
      hours: 12
      minutes: 0
      seconds: 0
      milliseconds: 0
    continue_on_timeout: false
    alias: Wait for notification response
  - if:
      - condition: template
        value_template: "{{ == \"notify_alf\"}}"
      - service: script.computer_quit_program
        data: {}
    alias: Fire TTS message if notify action has been chosen
mode: restart

Look in you automations.yaml file with a text editor. I have seen that a automation can be in the automations.yaml without beeing visible in the GUI, even with the same name/ID.
If it is there, remove it and save the automations.yaml file. I have rebooted HA afterwards, however not sure it is needed.

I noticed this today as well. I run HA core, and did an upgrade from 2022.08 to 2022.10 last night. Since then, all my automations (which used to be in yaml files) now get triggered twice with the old settings. Ghost autmations!

As @khvej8 have suggested, I will have to check the autmations yaml file

I’ve just checked my automations yaml files, there are no duplicates. My setup uses the automation.yaml file and also a sub-directory with more automations split up.


automation manual: !include_dir_merge_list automations
automation ui: !include automations.yaml

I’ve done some testing and to my supriced, when I remove automation manual: !include_dir_merge_list automations and then restart HA, I see that these automations aren’t loaded (as expected) when I check via the GUI.

However, when my devices trigger certain events, the automations still run (even though I’ve removed them entires, and the GUI not showing them either). Seems like the old automations are still loaded even thought I’ve removed the reference to those automations.

Is there any previous “state” of the automations stored somewhere? Perhaps as part of the upgrade process (backup perhaps???).

This is driving me crazy since I have no way of removing these ghost automations! Any help would be appreciated.


Just an update.

I restarted my machine (Raspberry Pi 4B) entirely and this seems to have fixed the issue.

What I tried yesteday was restarting HA (via the GUI and also linux service). Neither worked, as it still remembered the old automations.

However, restarting the machine seems to have fixed it!!

Never did figure out what caused it so I just deleted the automation and recreated it and it seems to work again at least.