#Automation set to mode: single is being restarted instead of running as single

1 messages · Page 1 of 1 (latest)

bitter oxide
#

I have the following automation which triggers a garage door opener. It is called from another automation which might fire multiple times in a short period.

in home assistant, i have an automation like this:

alias: Press West Garage Door Button
description: Press West Garage Door Button and then block further action for 15 seconds
triggers: []
conditions: []
actions:
  - type: turn_on
    device_id: 24a3a8a47b67a85dbbf30dc799047f24
    entity_id: 0da43d05e42724bb00062fb4c172d4a6
    domain: switch
  - delay:
      hours: 0
      minutes: 0
      seconds: 15
      milliseconds: 0
mode: single
max_exceeded: silent

Note the "mode: single". This is used to handle a garage door button, when called it trips the relay as if the button has been pressed, then does nothing for 15 seconds. This allows the door to move to whatever the new position might be and for the tilt sensor attached to update. There are multiple situations which call this automation, so the delay is there to make sure that only the first one actually results in the button press forcing everything else to be ignored for 15 seconds.

This isn't working. Despite the mode:single, when this automation is triggered twice within 15 seconds, it stops the first run and starts another as if it was mode:restart.

oak crystal
#

There's no trigger?

#

That should be a script

#

The mode in an automation determines whether it triggers when it's already running. You have no trigger there

bitter oxide
#

Yeah, it's being called via automation.trigger from another location. It's an automation simply because it makes it easier to handle from the UI.

oak crystal
#

it should be a script

bitter oxide
#

I've just done an end run around it, created an input boolean to act as a kind of semaphore, check the state on it as a condition, turn it on at automation start, turn it off 15sec later, and it seems to resolve the issue.

oak crystal
#

you can do exactly the same thing with a script, including creating it in the UI

#

then your mode will do what you expect

bitter oxide
#

What's weird about this is that it just started happening, this has been setup in this manner for a couple years and something in the past week has had it restart an automation that is in single mode

oak crystal
#

it's not how automations were intended to work, so it wouldn't surprise me if that behavior isn't consistent