#Resume an automation with condition
1 messages · Page 1 of 1 (latest)
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
Thanks I'll try, what are the downsides ?
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
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
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
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 ?
oh, yeah it might. its been a while since i used waits
yeah you are right - https://www.home-assistant.io/docs/scripts/#wait-for-a-trigger
i think i did it the other way because i needed to do some stuff on failure when i last used it
I tried with only 5s and it stop
Thanks !