Rule Machine - This is Frustrating the Heck Out of Me

Technically, you are not cancelling the delay. You are just checking if the door is currently open, 90 seconds after it opened.

Ha Ha. That's because I'm a lazy git and thought I'd just copy and paste one of my rules. Delete 90% of what I've got and your there!!!!!!!!! :smile: :smile:

2 Likes

The delay isn't really cancelled--you have to have a "Cancel delayed actions" action somewhere to cancel anything with the "Cancel?" flag set. Bruce explains how that works in this post: [Released] Rule 4.0 - #62 by bravenel

Your rule will mostly work because, as stated above, you're testing whether it's still open after the delay. This creates almost the same result (except possibly more scheduled jobs that will just do nothing when they're run instead of getting un-scheduled when they are known to no longer be needed--probably not a problem), but I see one important difference. Suppose you do the following:

  1. Time 0:00 - open door (triggers rule)
  2. Close door (does nothing)
  3. Time 1:29 - open door (triggers rule again)
  4. Wait at least one second, then close door

In this case, it seems to me that between steps 3 and 4, you'll get the notification from the first triggering of the rule because at time 1:30, the IF in that rule will evaluate to true. The example from @bjcowles above that uses a "Cancel delayed actions" when the door closes fixes this problem by truly un-scheduling the execution (at step 2 in my example sequence) instead of just testing the state when it it scheduled to be run again.

2 Likes

Yeah you are both correct. I forgot about testing opening the door again before the delay is over, so I see where that's wrong. However, I'm baffled how to make this work properly. Can you show me an example (gonna have to clean it up for my brain @bobbles! :rofl:)?

Thanks for a much better explanation than my ambiguous attempt.

@bjcowles has an example above that works, but a more general explanation of delays and cancelling in RM 4.0, I'd look at Bruce's original post in the thread: [Released] Rule 4.0. He has one example with motion-based lighting, but the whole section called "What became of Rule Truth and Cancel on Truth Change?" is quite ... illuminating.

What does the cancel do then? (I realise the trigger should be changed to "changed".

That cancel will do nothing unless you specifically 'Cancel Delayed Actions' somewhere.

1 Like

I've been schooled. The example @bjcowles gave works great. I was trying a delay before the speak with ELSE Cancel Delayed Actions after it was pointed out that my first example had a problem, but that second attempt would speak no matter what.

Appreciate the guidance guys. I will RTFM :rofl:

3 Likes

Also wanted to thank @pete3500 for the post. So silly I never thought of this use. We sometimes overpack the freezer and it doesn't close properly or bounces back open when you close the fridge door (it's an old fridge). That costs us quite a bit when we discover hours later that the freezer is slightly open and everything is covered in frost/half defrosted.

Appreciate the new project idea!

1 Like

Bob - Thank you for the schooling in RM 4.0. Really appreciate it. And my guess is that looking for "changed" in place of open/closed (unlocked/locked) makes this more efficient than my RM 3.0 rule.

Spent the last hour changing several of my RM 3.0 rules to RM 4.0!

1 Like

Wow! Thanks to everyone, I figured there was a way, but I couldn't have asked for more help!! Everyone kicks ass!!

1 Like

No problem!! Here's what mine looks like.


1 Like

Can someone tell me what is wrong with this rule? It all works except the repeat will not shut off when all the doors/windows, whichever one was open, are finally closed. thanks

I think you need to put the "END-REP" above the ELSE-IF statement. The END-REP acts as a bookend to the "Repeat ever..." And you might be able to remove the Delay statement and just select delay on the Notify action (Speak on Living ...)

I moved it above endif but it still wants to repeat.

Hi never said that, he said

And that is where it should go.

You also need a stop repeating actions before the end-IF.

BTW I don't understand the delay? Why not just repeat every 45 seconds. Then remove the cancel delay and just have stop repeating.

Here is what I have. @BorrisTheCat Thanks for the help, I just said the wrong thing, I did put it above the elseif. See pic. The delay is for when my wife opens the laundry room door to get a mop it won't announce the door being open and then closed if she does it within 15 sec.

This works great now.

2 Likes

That will only announce the last device that was opened or closed if another one is open. And you will end up with multiple announcements, potentially for a window/door that is closed.

Let's take an example...you open Dining Room Window Sensor East. That announces. Now you open the front door. That begins announcing, also every 30 seconds. Then you will get two announcements every 30 seconds until they are BOTH closed.

Now, when you close the front door, the front door announcement won't stop. In fact, you are going to get a second front door announcement. I t has triggered twice and %device% is the triggering device and the IF part of your rule will still be true, even though it was the one that closed. You can see how you could easily begin to get many announcements in a very short window of time. Hopefully, everyone keeps everything closed.

1 Like

@Ryan780 So am I to understand that this rule would serve better if each of the sensors had this rule on an individual basis? That would be a lot of rules. If not, is there a better way?

Would changing the trigger to any open make any difference? thanks