Delay with Cancel on Truth change not working

Unless I'm missing something, this:

Does not work.

image

Even though the Switch was turn off (->Truth Changed), the following action was not executed.
Looks like the hole rule is stopped and not just the Delay.

Looks like it worked as designed to me... Once the rule goes TRUE to FALSE the TRUE actions no longer run...

It isn't just the DELAY that gets cancelled, it is everything after it, too.

If you explain exactly what you are trying to do, maybe we can suggest a different way to do it?

Nop.

I have lots of rules that continue to run even though the state (Truth) changed.

What this particular action should do "logically" is if the truth change before the delay of 5 min, continue with the rest of the rule.

Not how it works on mine with a cancel on truth change setting... But ok. Maybe someone else will chime in.

Also, if you look at the description, it really says: Cancel THIS delay... and
not Cancel this rule.

Don't know. Maybe @bravenel will have time to chime in later.

Cancelling a delay cancels everything after it. A delay suspends execution of the rule actions for some period of time. If the delay is cancelled, it never comes back.

Explain what you're trying to do.

OK, so maybe you should change the description of "Cancel this Delay on ..., because it's a bit confusing.

What I really want to do is something like:

Condition:
Garage Door Open
Action:
Some Stuff
Wait for the Garage Door to close OR Proceed with the rest of the rule after a Delay of 5 minutes
Some More Stuff (a lot)

Simple

I cannot use "wait for condition" because the door might stay open for a reason and there is no timeout for this action.

Any way to do this?

I saw what you posted earlier about wanting a way to dismiss a wait after elapsed time. I'm thinking hard about that right now. I agree about its usefulness.

I'm not going to spend time right now figuring out how to do what you want, as I'd rather work on your idea!

Couldn't you just use a WAIT instead of delay? Just a passing thought. Might not work for your specific needs.

If you're thinking about adding a TimeOut x for "Wait for Condition/Event" that would be GREAT!!
At the same time, I think a Delay xx with Cancel on truth change that just continue instead of stopping the rule would also be great.

For now, I'll use a simple Delay command followed by some tests on the Door status but that's not optimal.

You make a good point about Cancel "this delay". For the case of a delay attached to an action, it should only cancel that specific action. This is in fact what it does. Because that particular action has been hung off a timer, cancelling the timer means that action won't run. Other actions after that delayed action have already run.

For Delay Actions it is less clear what to do with cancel. The whole idea of cancel is to cancel some delayed actions. So, in this case it makes sense to me for everything following the Delay Actions to be cancelled.

For the Delay Action, it should definitely cancel everything after the cancel. Here are two thoughts on the wait function though:

  1. Add a timeout to the wait that would either cancel the wait or complete the wait, selectable by a an option in the wait.
  2. Add a "complete wait" funciton to be run from other rules.

Good point also but If I recall you already have (or used to have in an earlier version of RM) a "Cancel on Truth Change" for Rules, right? That one was used to cancel/stop everything.

But the one associated with Delays "Cancel This Delay on truth change", should only stop the delay and continue processing with the rest of the rule actions. And if you removed the "Cancel on truth change" in RM 3.0, maybe you could bring it back...just my 2 cents.

Anyway, if you could implement a TimeOut on "Wait for Condition/Event" that would be more than great.

1 Like

This is the way it works. A delay on an action does not delay the rest of the actions after it, so cancelling it only affects that action. Cancel on truth change is still in Rule 3.0.

Understood.
But I was just using a simple Delay and not a Delay on action.

So if Cancel on truth change is still in RM 3.0, The Cancel This Delay on truth change is ... a bit useless don't you think? We just have to turn on Cancel on truth change to achieve the same thing.

Try something like this-

Condition:
Garage Door Open

Actions for True:
Some Stuff
Some More Stuff —>after a delay of 0:05:00 (cancel on truth change)

Actions for False:
Some More Stuff

When the garage door opens it runs the actions for true, which does Some Stuff and schedules Some More Stuff to happen in 5 minutes.

If the garage door closes before 5 minutes, the scheduled event gets cancelled because of the truth change, but it also runs the actions for false, which immediately does Some More Stuff.

I think that should do what you want.

Thanks but the "Some More Stuff" is in fact "A Lot of More Stuff" that would have to be duplicated in Actions for True and Actions for False...at least for what I want to achieve.

No news on a TimeOut on Wait for Event/Condition?

This is in Rule 4.0, currently in beta testing, but only for Wait for Event, which in Rule 4.0 is Wait for Events. Wait for Events will allow multiple events, and a new event "Elapsed Time" is available in that context. Each event independently could end the wait.

3 Likes

If you need a Beta tester...I'm in!!!

I was a Beta tester for Stringify for a while...mainly for Geofences issues.

Let me know.