#Resume an automation with condition

1 messages · Page 1 of 1 (latest)

rotund tinsel
#

Hey everyone,

I'm making an automation for my vacuum, I have a notification if the door is closed, can I pause the automation and resume it when I open the door to start the vacuum ?

sand blaze
#

you could put in a "wait for trigger" and have the trigger be door is opened.
this approach has some downsides but its a simple solution

rotund tinsel
#

Thanks I'll try, what are the downsides ?

sand blaze
#

if there is a reboot whilst its waiting it doesnt resume after reboot and depending on how your automation works this could cause expected state.

if things happen at the same time it could get caught in a expected state and might get stuck and cause expected behavior

in general automations that sit "running" for a long time are not a good idea

#

without knowing your automation its hard to say what could potentially happen but if its firly simple then you are realisitically probably okay. just keep in mind if it might be running when you reboot for updades or something

rotund tinsel
#

Can I add a timer ? If I don't open the door within 5 minutes it stop ?

#

I just saw I can add one directly

sand blaze
#

you can set a timeout but if it triggers or times out it continues the same.
so you would probably want an if block after that says: if closed then stop

#

so it would be something like
if closed then wait for open or 5 minutes
if closed then stop automation
other
automation
stuff

rotund tinsel
#

wait_for_trigger:

  • type: opened
    device_id: 62b1e6364583340af510dee16d1ae915
    entity_id: 04f456e0f1a16eb2b2473d5d50dffbad
    domain: binary_sensor
    trigger: device
    timeout:
    hours: 0
    minutes: 5
    seconds: 0
    continue_on_timeout: false

Continue on timeout false don't mean it stop the automation ?

sand blaze
#

oh, yeah it might. its been a while since i used waits

#

i think i did it the other way because i needed to do some stuff on failure when i last used it

rotund tinsel
#

I tried with only 5s and it stop
Thanks !