SmartThings Community

How To Kill/Stop Currently Running Automations/Rules/Processes?

(ocpd+adhd+alz+md+hfa+fms+lol=me :)) #1

Is this a thing? Sure would be neat…

If a rule exists (like, in RM) that tells the system to do something that will take it a while to complete, and if that rule has already fired, and the process of carrying out whatever the rule says to do is already going, is there any way of stopping it?

e.g. A rule that makes a light flash as an alert mechanism; using a sequence of X-number of flashes over a certain period of time to make the flashing go on for a while (to make sure the user notices it at some point)…

Continuing the discussion from Flashing light:

Flashing light

If you immediately know the candlelight is fire, the meal was cooked long ago.

The flashing is often done by the device itself. Not by a loop in the rule.

No rule is allowed to run for more than 20 seconds in SmartThings, and most take much less than that.

So the rule runs and tells the device to start flashing. The rule stops, the device starts. This is true for both flashing lights and for things like sirens and strobe alarms.

So there’s no point in telling the rule to stop, it’s already done. :wink:

The question is whether the device will accept the new instruction to stop flashing before the expected end of the sequence. Some will, some won’t. It just depends on the features of that device.

Most zigbee lightbulbs will not accept an interrupt to a flash request (which is 15 blinks). Most strobe alarms will. But it just depends on the details of each situation. Nothing to do with the rule, though: “the meal was cooked long ago.”

(ocpd+adhd+alz+md+hfa+fms+lol=me :)) #3

e.g. #2
A rule configured to turn on fans when master bathroom shower starts (i.e. bathroom ceiling exhaust fan, whole house HVAC fan, and a ceiling fan in the adjacent master bedroom). I don’t have this yet, but I’m working out the details in my head for future usage.

I would want it to turn the fans on right away, and leave them on as long as the shower is running. Then, if shower remains on for longer than a minute, then have fans stay on for 15 minutes beyond the time when the shower turns off.

I’m pretty confident I know enough how to do such a rules setup in Rule Machine when the time comes.
However, would there be any way of stopping the whole process once it has begun?

I know I can disable the rule so that it doesn’t fire anymore, but what about the processes that the rule has already started going? How much of the rule as described above would be in a ‘stopable’ state, and how much of it would be things that were already told to happen, and ya can’t get them back inside the gate?

(Michael) #4

Not sure if you’re hearing JD right…

To stop the processes after they’ve started, you’d want to set up another rule / process to stop it…

(ocpd+adhd+alz+md+hfa+fms+lol=me :)) #5

You may be correct.
Do you have any specific examples to share that might snap me out of my funk?

(Michael) #6

I’m still learning here too, so I’ll depend on those more knowledgeable (such as @JDRoberts) to correct me.

Still, going off your 2nd example, there is 2 steps. 1st, you want a bunch of fans to turn on when the shower kicks on. Let’s assume this is functioning as you want it to. 2nd, you want to turn the fans off based on a certain set of rules. This should be seen as an entirely different set of rules from step 1 in most cases (when the shower turns off, then turn off the fans in 15 minutes). You’d set up a new app / rule with its own set of rules based when the shower turns off to turn off all the fans.

If you want to be able to manually turn all the fans off (or on) through the app, I would assume there are several ways to achieve that but setting up a virtual switch is the 1st that jumps to my mind. Then the action of turning off several fans becomes as simple as turning one device off. I’d imagine this would clean up a bunch of code in the SmartApps / Rules as well.


Before he wrote rule machine, one of the things that @bravenel frequently helped people with in the community was exactly this kind of problem. How do you provide an override to a scheduled event?

(note that I am very intentionally not saying an override to a rule. The rule runs and creates a schedule. Now you want to have the ability to not execute the schedule. I know this is a technical distinction, but it’s an important one.)

The most common request were to have a way to override A light based on a motion sensor.

For example, one community member had a light that came on because of a motion sensor and wanted to be able to flip a switch that would prevent that when their new baby was sleeping.

There are a number of other examples.

If you search the forums for “override motion sensor” or even “baby sleeping” you should find several examples of his work complete with snippets of code.

Those were all one off solutions. It was in part the fact that he had done so many of these that I think led to his inspiration for rule machine. But in any case, the point is that examples of code for these kinds of solutions already exist in the forums.

I personally can’t help with this because I can’t read code. (I depend on a text to speech reader and, trust me, you don’t want to do groovy with text to speech. ) but there are many other people who could help, so I’m sure someone will jump in. :sunglasses:

(ocpd+adhd+alz+md+hfa+fms+lol=me :)) #8

Yes, I know about virtual switches, and I have many of them in my setup already; doing various things.
I have some for transferring info from one system to another (e.g. if something can’t see whether or not some other thing is in a certain state, but it can see whether a switch is on or off, I use an on/off switch to sort of ‘translate’ the state of that thing (whatever it is) between them. In other situations, I just have some set up as single light switches, and with others, they act as a multi-light switch; turning a whole series of lights on/of all at once.

I also know about the disable option in Rule Machine, and I do already have a number of disable switches (some to disable single rules, others to disable sets of rules, and one BIG one to disable all of my rules).

However, that only stops the rule from operating; it has nothing to do with the automations which those rules set in motion. Once the rule fires, and creates the schedule in the system, I assume all of that keeps running and the system processes whatever commands were fed in at the moment the rule fired.

I guess what I’m probably really asking about is… once that hand-off has occurred and those processes have actually been scheduled in the system, is there any way of sending another command into the system to halt processing of anything that’s already been scheduled?

I suspect the answer is ‘No’.

I also suspect this question has already been answered…possibly even already by JD above, and I just missed it somehow. Well…also…my understanding of ST and what’s actually going on behind the scenes is finally catching up too. So, I may have a completely different way of thinking about something at the end of a post than I did even when I first started typing it. lol

As usual @JDRoberts thank you :slight_smile:

(Robin) #9

It was a question I asked on another part of this site that triggered @sgnihttrams to start this new thread.

My question was:

Can anyone help with adding a cancel option for ‘The Flasher’? (smart app)

I have my lights set-up to flash on an alarm situation (10 minutes worth of flashes) via a momentary button tile and rule machine.

When I disarm the Smart Home Monitor rule machine turns off my siren but it cant stop the flashing. The “set for specific mode” option in The Flasher can stop it starting in the first place but wont stop an ongoing sequence.

Would be great if the Flasher could be stopped through momentary button tile or switch. I have played around with the code for ages but cant figure it out.

For now I am using a clunky workaround using 2 instances of The Flasher. 1 to flash just once, triggered by the other to flash 100 times. I can then use modes to stop the individual flashes.