I have a script that runs a handful of fans and an AC on boost mode for 20 minutes, to rapidly decrease temperature. I have a Lovelace button that calls this script.
What I’d like is an ability to a) cancel running the script and b) return to the device states before running the script. B) is optional.
How can i do this? I was looking into script.toggle and script.turn_off but I’m not sure what these even do, they do not seem to do what I want. Thanks!
Yes but what do these actually mean? They do not effect the running devices (the actual fans and AC at all). I understand those cancel the script so steps in the future do not trigger but how do I actually stop what’s happening and return to the pre-run state?
There is a caveat to stopping a running script. You can only stop or cancel a script which has a delay or wait in it. If your script is just a bunch of service calls the script will just execute and won’t give you a chance to cancel it.
Hi folks, this is a really interesting moment with HA. Sure, as @tom_l says, script off makes sense and as @squirtbrnr says, if you trigger a bunch of services or turn on button helpers, these are different entities living their triggered state. What a blow on a head when designing a logic in your HA. So, the solution is to stop the script from executing next steps in the sequence AND (in my situation) if you do not want to have your house flooded, you must immediately shut down the valves that were triggered. Understandably…
Lovely! It’s better if the logic is so straightforward and do not presume our expectations…
I know this is an old thread, but I could use some help and this is my exact problem. My experience has been that script.turn_off just doesn’t work.
I have this wonderful little script that sweeps through my backyard lights changing the color each time. It’s cool. But if I set it to run like 200 times, I can’t stop it. I made a separate script that calls script.turn_off action against the script that I’m trying to stop, and it doesn’t seem to do anything.
I don’t believe you can stop a for loop. A for loop is treated as an action in the sequence. You can only stop a sequence during a delay. It would be helpful if you posted your code in your own thread for better visibility since it’s specific to your issue.
I am a little new to HA’s script capability. After I posted this, I looked a little closer and realized I was not actually targeting the right script in the first place. I updated it and it works fine. The script does have the required delay commands, So… PEBKAC