Rule using While. Have a question

I wrote the attached rule.
I'm trying to get notification if the garage door was left open for more than 10 minutes (as long as no one is in the garage.) Want message to repeat every 15 min if the door is stays open.

Need clarification for the following:
If the garage door is closed while this rule is running, will it trigger the rule again and cancel the "while" expression and/or the delay from the first time the rule was run? For example the door is closed within the initial delay of 10 min or it gets closed after the following repeat notifications?
Should the 10 min delay go before checking if the motion sensor or does it matter?
Thanks for any help or suggestions.

I think you need to put in a 'STOP REPEATING ACTIONS' before your exit rule.

IF
Garage door closed
THEN
Stop Repeating Actions
Exit rule

Then the rest of your rule.

No. The rule will just run a second time, but the exit rule will stop that second instance (not the first). You could set the trigger to be “Open” and you would eliminate the need for the first if condition.

The While garage door open will continue until the door is closed.

I would recommend changing the Delay 0:10:00 to Wait 0:10:00. The wait will be cancelled and re-started if the rule door is open a second time. Or with how it is currently triggered, it will be cancelled if the door is closed.

So, this should do it?
The rule will let me know when the door has been open more than 10 min and keep informing me until the door is closed. If the door is closed during the 10 min wait it will exit the rule?

1 Like

It looks like it would work. Test it out and let me know! :smiley:

Works as expected but I think a second copy of the rule triggers when the door is closed during the While loop running. Is there a statement that would cancel the original copy of the rule if the door is closed or should I just change the trigger to door open instead of changed.

app:7402021-12-19 04:44:35.345 pm infoAction: END-IF

app:7402021-12-19 04:44:35.342 pm errorMultiple simultaneous rule execution error

app:7402021-12-19 04:44:35.339 pm infoAction: END-IF

app:7402021-12-19 04:44:35.337 pm errorMultiple simultaneous rule execution error

app:7402021-12-19 04:44:35.302 pm infoAction: END-REP

app:7402021-12-19 04:44:35.298 pm infoAction: Set Volume on Family Room speaker to 30 (skipped)

app:7402021-12-19 04:44:35.293 pm infoAction: Notify Frank's Phone and Speak on Announcer, Family Room speaker(volume: 85): 'The Garage Door is STILL OPEN' (skipped)

app:7402021-12-19 04:44:35.246 pm infoGarage Door Open: Action Repetition ended

app:7402021-12-19 04:44:35.208 pm infoAction: While (Garage Door open(F) [FALSE]) Repeat every 0:15:00 (not repeating)

app:7402021-12-19 04:31:04.363 pm infoGarage Door Open Exited

app:7402021-12-19 04:31:04.263 pm infoGarage Door Open Triggered

app:7402021-12-19 04:31:04.249 pm infoGarage Door Open event: Garage Door contact closed

app:7402021-12-19 04:29:35.793 pm infoAction: END-REP (waiting for next)

app:7402021-12-19 04:29:35.118 pm infoAction: Set Volume on Family Room speaker to 30

app:7402021-12-19 04:29:34.963 pm infoAction: Notify Frank's Phone and Speak on Announcer, Family Room speaker(volume: 85): 'The Garage Door is STILL OPEN'

app:7402021-12-19 04:29:34.937 pm infoAction: Repeating Actions While True

app:7402021-12-19 04:29:34.879 pm infoAction: While (Garage Door open(T) [TRUE]) Repeat every 0:15:00 (repeating)

app:7402021-12-19 04:29:34.715 pm infoWait over: timeout

app:7402021-12-19 04:29:34.712 pm infoGarage Door Open event: timeout

app:7402021-12-19 04:19:34.548 pm infoAction: Wait for event: --> timeout: 0:10:00

app:7402021-12-19 04:19:34.402 pm infoAction: Set Volume on Family Room speaker to 30

app:7402021-12-19 04:19:34.244 pm infoAction: Notify Frank's Phone and Speak on Announcer, Family Room speaker(volume: 85): 'Garage Door is OPEN'

app:7402021-12-19 04:19:34.236 pm infoAction: IF (Garage Motion inactive(T) [TRUE]) THEN

app:7402021-12-19 04:19:34.174 pm infoAction: IF (Garage Door open(T) [TRUE]) THEN

app:7402021-12-19 04:19:34.068 pm infoWait over: timeout

app:7402021-12-19 04:19:34.065 pm infoGarage Door Open event: timeout

app:7402021-12-19 04:16:33.973 pm infoAction: Wait for event: --> timeout: 0:03:00

app:7402021-12-19 04:16:33.968 pm infoAction: IF (Garage Door closed FALSE) Exit Rule (skipped)

app:7402021-12-19 04:16:33.890 pm infoGarage Door Open Triggered

app:7402021-12-19 04:16:33.873 pm infoGarage Door Open event: Garage Door contact open

Using Open or Closed is typically a better option.

ok. Thanks I will change that to Open and delete the first IF statement
I'm not sure what is causing the error in my log, but the rule works as expected.
I could just ignore it but I'm trying to learn the right way to use RM

1 Like

If you’re like me, the more you use it, the more you’ll learn. Then in a year, you will go back to your original rules and wonder why you made them so complicated… :smiley:

There are many ways to do the same actions. Some are probably more efficient than others, but when a rule only runs once in a while, it has very little impact. The important thing is that the rule performs the action that you need it to.

Thanks again. Here's my final rule. For now :wink:

1 Like

@FLGuy Here is my door left open rule. You would just need to remove the secondary door (in this case back door) and change notification to 15 mins from 2. I also have it so if I push a pico switch to trip a virtual button(Mute Switch) it turns the notifications off until the door closes thereby resetting the rule.