core: Automation does not stop or ends incorrect, which causes Already running messages

The problem

Some automations (randomly) do not end correctly which results in warning messages: 2023-08-05 10:53:24.273 WARNING (MainThread) [homeassistant.components.automation.lampen_gang] Gang lampen: Already running.

It’s a bit hard to track but one of my automations is run very frequently and therefor I was able to log the issue.

Ones this occurs I have to restart HA. It’s not related to this specific automation. I also have seen it on other.

What version of Home Assistant Core has the issue?

2023.8.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

2023-08-05 09:34:04.737 DEBUG (MainThread) [homeassistant.components.automation.lampen_gang] Automation trigger 'None' triggered by state of light.lampen_gang
2023-08-05 09:34:04.738 INFO (MainThread) [homeassistant.components.automation.lampen_gang] Gang lampen: Running automation actions
2023-08-05 09:34:04.742 INFO (MainThread) [homeassistant.components.automation.lampen_gang] Gang lampen: Choose at step 1: choice 1: Running automation actions
2023-08-05 09:34:04.743 INFO (MainThread) [homeassistant.components.automation.lampen_gang] Gang lampen: Choose at step 1: choice 1: Choose at step 1: default: Running automation actions
2023-08-05 09:34:04.744 INFO (MainThread) [homeassistant.components.automation.lampen_gang] Gang lampen: Choose at step 1: choice 1: Choose at step 1: default: Executing step device automation
2023-08-05 09:37:37.372 DEBUG (MainThread) [homeassistant.components.automation.lampen_gang] Automation trigger 'None' triggered by state of light.lampen_gang
2023-08-05 09:37:37.373 INFO (MainThread) [homeassistant.components.automation.lampen_gang] Gang lampen: Running automation actions
2023-08-05 09:37:37.379 INFO (MainThread) [homeassistant.components.automation.lampen_gang] Gang lampen: Choose at step 1: choice 1: Running automation actions
2023-08-05 09:37:37.382 INFO (MainThread) [homeassistant.components.automation.lampen_gang] Gang lampen: Choose at step 1: choice 1: Choose at step 1: default: Running automation actions
2023-08-05 09:37:37.382 INFO (MainThread) [homeassistant.components.automation.lampen_gang] Gang lampen: Choose at step 1: choice 1: Choose at step 1: default: Executing step device automation
2023-08-05 09:49:47.532 DEBUG (MainThread) [homeassistant.components.automation.lampen_gang] Automation trigger 'None' triggered by state of light.lampen_gang
2023-08-05 09:49:47.533 INFO (MainThread) [homeassistant.components.automation.lampen_gang] Gang lampen: Running automation actions
2023-08-05 09:49:47.534 INFO (MainThread) [homeassistant.components.automation.lampen_gang] Gang lampen: Choose at step 1: choice 1: Running automation actions
2023-08-05 09:49:47.535 INFO (MainThread) [homeassistant.components.automation.lampen_gang] Gang lampen: Choose at step 1: choice 1: Choose at step 1: default: Running automation actions
2023-08-05 09:49:47.535 INFO (MainThread) [homeassistant.components.automation.lampen_gang] Gang lampen: Choose at step 1: choice 1: Choose at step 1: default: Executing step device automation
2023-08-05 09:50:27.757 DEBUG (MainThread) [homeassistant.components.automation.lampen_gang] Automation trigger 'None' triggered by state of light.lampen_gang
2023-08-05 09:50:27.758 WARNING (MainThread) [homeassistant.components.automation.lampen_gang] Gang lampen: Already running
2023-08-05 10:27:33.403 DEBUG (MainThread) [homeassistant.components.automation.lampen_gang] Automation trigger 'None' triggered by state of light.lampen_gang
2023-08-05 10:27:33.404 WARNING (MainThread) [homeassistant.components.automation.lampen_gang] Gang lampen: Already running
2023-08-05 10:53:24.272 DEBUG (MainThread) [homeassistant.components.automation.lampen_gang] Automation trigger 'None' triggered by state of light.lampen_gang
2025-08-05 10:53:24.273 WARNING (MainThread) [homeassistant.components.automation.lampen_gang] Gang lampen: Already running

Example YAML snippet

alias: Gang lampen
description: ""
trigger:
  - platform: device
    type: turned_on
    device_id: 24ebf39cdf4049f553684a0acfd49ebf
    entity_id: light.lampen_gang
    domain: light
    id: S1-switch
  - platform: device
    type: turned_on
    device_id: 24ebf39cdf4049f553684a0acfd49ebf
    entity_id: light.lampen_gang_2
    domain: light
    id: S2-switch
  - platform: device
    type: turned_off
    device_id: 24ebf39cdf4049f553684a0acfd49ebf
    entity_id: light.lampen_gang_2
    domain: light
    id: S2-switch
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: S1-switch
        sequence:
          - choose:
              - conditions:
                  - condition: state
                    entity_id: input_boolean.lightson
                    state: "on"
                  - condition: device
                    type: is_off
                    device_id: 0a034a1cea88e3ff62c950782e7cf10a
                    entity_id: switch.staande_lamp
                    domain: switch
                sequence:
                  - type: turn_on
                    device_id: 24ebf39cdf4049f553684a0acfd49ebf
                    entity_id: light.lampen_gang
                    domain: light
                    brightness_pct: 1
            default:
              - type: turn_on
                device_id: 24ebf39cdf4049f553684a0acfd49ebf
                entity_id: light.lampen_gang
                domain: light
                brightness_pct: 20
      - conditions:
          - condition: trigger
            id: S2-switch
        sequence:
          - choose:
              - conditions:
                  - condition: device
                    type: is_on
                    device_id: 24ebf39cdf4049f553684a0acfd49ebf
                    entity_id: light.lampen_gang
                    domain: light
                sequence:
                  - type: turn_on
                    device_id: 24ebf39cdf4049f553684a0acfd49ebf
                    entity_id: light.lampen_gang
                    domain: light
                    brightness_pct: 100
            default:
              - type: turn_off
                device_id: 24ebf39cdf4049f553684a0acfd49ebf
                entity_id: light.lampen_gang
                domain: light
    default: []
mode: single

Anything in the logs that might be useful for us?

No response

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 20 (6 by maintainers)

Most upvoted comments

Ok, thanks for the guidance. Was not aware of this 😦

trace automation.wake_up_pre_post_actions 2023-08-06T16_15_00.319693+00_00.zip

So apparently some other people on the forum had this as well. The current theory is that the Z-Wave device have a latency issue. I am no expert, but that’s what I’ve heard.

Can you maybe track down this for the other automations without Z-Wave devices? Maybe it could lead to a wider problem or problem in more integrations

I am no expert in the best way to log these things sadly