When I want to use my treadmill, I issue a command to turn it on.
The light in the room is set with a triggered rule. Whenever the treadmill is turned on, the light comes on. Turning off the treadmill triggers light off after a delay.
If I change my mind after turning off the treadmill and turn it back ON with the light still ON, I want to cancel the command to turn off the light after the delay expires. To achieve this, I thought it would be a good idea to set a triggered rule to cancel the action "turn off light after delay" whenever the treadmill is turned on. But it doesn't cancel the action. I'm on the treadmill and the light comes off.
I tried the same thing with a non-triggered rule. (cancel the action as long as the treadmill is ON). Same result.
Why is this not working?? (I upgraded to latest version yesterday, btw)
You're making it too complicated.
Just use a Rule for the light based on the on/off condition of the treadmill. In the Actions for False part put in whatever delay makes sense before the light would turn off, with Cancel on Truth Change. If the treadmill is turned back on before the light turns off, it won't turn off.
I have a similar question where I think I can rewrite with Cancel on Truth Change but am curious if I'm just misunderstanding "Stop actions" or if there's a bug.
Let's say I have a triggered rule that has a delay (contrived simple example):
Trigger: button pushed
Condition: switch on
Action on true: turn on light, delay 5 minutes, turn on other light
Action on false: stop actions: ** this rule **
I would expect that if the button is pushed once with the switch on that the true action would start.
If the button was pushed again with the switch off prior to the 5 minute delay elapsing, I would have expected the delay to cancel along with the second light turning on. But what I'm seeing is that this does nothing and the delay elapses and the other light turns on.
Stop Actions: **This Rule** doesn't stop the delay here, is it that it doesn't work in triggered rules or that it doesn't work for delays?
Please actually show a real rule that doesn't work. Happy to investigate. Don't know the answer to your question without a clear context.
I had noticed this in the past and just assumed "stop actions" doesn't work with triggered rule delayed actions, I can confirm that it does work with repeat actions in a trigger though.
I believe this example would work to show what @rvrolyk is asking about. I did it with two different triggers but the context should be the same. Pressing the button starts a 30 second delayed notification. Holding the button should cancel this delayed action? The logging seems to indicate that it did, but it doesn't.
I believe @rvrolyk is asking why this doesn't actually cancel the delayed actions of a triggered rule?
Yes, that's exactly what I see. Thanks for providing the sample rules.
@bravenel I can provide my exact rule this evening if it helps but aside from being in a single triggered rule, it's quite similar to what @halfrican.ak outlined.
OK, I will look into it. I can go with what @halfrican.ak came up with.
Thanks for looking. In case it helps the diagnostics at all, I tried setting this up as a regular rule as well and found that it only stopped if the delay had "cancel on truth change" attached to it.
e.g, this worked
But removing "cancel on truth change" meant that the action didn't truly stop (after 2 minutes, the kitchen lights came on).
I too am seeing that stop actions of other rules doesn't work. I have two rules for setting the volume of my Google Home Hub. At 10pm, I would expect the night rule to fire setting the volume but then the false part of the day rule fires even though the stop action is in the Night rule. Why?!?!?
Are you talking about stopping the delay?
I'm talking about stoping the actions of the other rule. That's what the "Stop Actions of Other Rule" is supposed to do, correct? In simplest terms, if two rules fire at the same time:
Action for rule a:
Action for rule b:
Cancel actions for Rule A
Then X should never happen, correct?
It seems as though the issue was actually that I wasn't able to predict the order in which the rules would fire. When I add a delay of 5 seconds to the Stop action, it works as expected. So, I think that might be some people's problem with Stops. We're assuming that things are happening at the same time but nothing can truly happen simultaneously. One always has to happen first, right?
No, Stop doesn’t stop the actions of another rule.
As it says when you choose this action, it stops Periodic, Delayed, Repeat, Fade Dimmer, Wait for Event — in other words, things that might continue beyond the execution of the rule. It appears there may be a bug with respect to Delays. Also, the UI doesn’t mention Wait for Event.
Well, obviously there has to be some type of pause (delay, wait, repeat, etc) for the stop to have any effect. It just runs through all the actions if there isn't something to make it stop for some reason, so there'd be no way to stop it. I understand that. If you look at my example, there is a delay. So, in the example that I listed, action X should not happen, correct?
That's what I asked above, if you are talking about the delay. The OP is saying there is something wrong with Stop and delays. I don't know, haven't had a chance to look at it yet.
I can confirm that there is a bug with Stop for delays. It would stop delays with cancel on truth change, but not other delays. The fix is done, and should be released in a hot fix this weekend.
Sorry for the inconvenience.
Ah! Does this explain the problem submitted in my original post?
Thanks for the quick fix! I really appreciate how responsive the team is.
Bruce, if one is using cancel on truth change (in a delayed action) or stop on truth change (in a repeat) is there any reason to use stop actions this rule as a false action as those actions would be canceled with the change of truth anyway?
Earlier generations of RM didn't check for truth change until the "repeat time" was reached would allow an action to run "one more time" than expected if the change in truth occurred during the waiting period, using stop actions this rule seemed to prevent that?
+! @halfrican.ak's question @bravenel.
Also, I just want to make sure I am understanding correctly. While the "Cancel on Truth Change" doesn't apply to triggers, sine there is no truth, the "Stop Actions for This rule" or "stop actions for another rule" would both still cancel a delayed action within a trigger, correct?