Is there a way to stop a running script or automation? For instance if I have an automation that does
do A
delay 10s
do B
Can I stop the sequence during the delay in some easy way? I know I can do this if I move the automation to appdaemon, but I would prefer not to at the moment.
I hope that I have overlooked something, but I can only think of one way to do it but it’s not pretty…and that is keeping ‘do B’ in a second automation that uses some input_booleans for conditions and triggers, and trigger the second automation from the first.
# Pseudocode
input_boolean:
boolB:
name: boolB
stopB:
name stopbool
automation:
- alias: autoA
trigger: <whatever>
action:
- (do stuff A)
- delay: '00:00:10'
- set boolB to 'on'
- alias: autoB
trigger: <state of boolB set to 'on'>
condition:
<stopB is 'off'>
action:
- (do stuff B)
No, conditions can only be used to decede wether or not the automation will run at all. You cannot stop it by changing that condition while the automation is running. But you can use the automation to run a script, and instead stop that script using homeassistant.turn_off, like @Danielhiversen described.
will it work the same for automation as well?
in my case i have a sequence running as action in automation, will i be able to stop this sequence by using the following or it will just make my automation state to off:
ever figured this out?
i also want to create an automation
action 1 , delay 30 sec , action 2
but for some reason, i want to stop the automation if needed in the delay timer
if i turn_off the automation, will it stop the sequence if it was actually running? if yes
then i can do turn_off and and turn_on again afterwards, so the initital state is ON again for the next automation …