Can't get this RM4 to cancel repeat

Hey again,

This rule triggers as written, repeats every 10 mins, however once the door is closed, the repeat does not stop.

What am I missing?


You need an END REPEAT before the ELSE.

Also, your trigger is only at a specific time. At Sunset -30, if the door is open it’s going to start repeating. At Sunset -30 if the door is closed it won’t start repeating. It’s only triggered that one time, so there’s nothing to send it down the other path.

As stated above, this rule will only trigger once: 30 minutes before sunset. Unless you're calling these actions from another rule, they'll only run when this trigger happens. Here, this matters because if the door is open at 30 minutes before sunset, the "IF" will evaluate to true and the first half that block will run. But if the door closes, the actions won't run because (nothing is triggering them to), so your "ELSE" won't get a chance to run and cancel the actions--at least not until the next day, when they'll finally get cancelled if the door is closed then.

To fix this, I'd suggest a rule like the following (EDIT: but see below for a further correction):


I think the door changing is a good condition to use here. That way, the rule will be triggered when the door closes and the repeat can be cancelled. You can check for the time in the rule itself; it's probably not the best thing to use for a trigger in this case.

I made some guesses here since with your trigger as-is, it's not clear what you wanted, but more or less the notifications will stop just before midnight (you could probably choose sunrise but I avoid this if possible since it's never clear if "between sunset and sunrise" will always evaluate to false or if it's smart enough to go with the next day' hopefully a few hours of notification is enough!). You can probably figure out how to customize this more if needed.

So what happens if the garage door was opened earlier in the day and is still open at Sunset-30? You might also need another trigger for the specific time of sunset-30 to make it run at that time just to check if the door was already open.

You're right. That is an easy way to solve the problem with the way I wrote that rule. Personally, I'd probably break apart my AND into two separate IFs, put the REPEAT around (not inside) the inner one, and move the check for time to that one. Either would be more or less equivalent, aside from a few minutes' difference as to when the notification happens if happens to be open at that exact time. Thanks for the catch!

This also got me thinking: in the event you ever intentionally open the door after sunset, you'll probably want at least a small delay before the first notification. Something like a "Delay 0:02:00 (cancel)" right before my new proposed location for the REPEAT should do it. That way, you won't get pestered if the door stays open for under two minutes (presumably someone just coming home and intentionally opening it for a minute or two max) and it happens to be after sunset.

Hey folks

Great conversation here

In fact, I have 2 different rules that speak to exactly what is being discussed here since I haven't been able to figure out how to combine them yet

Rule #1
Check if the door is open at Sunset -30, sends notification and repeats every 10 mins until it's closed

Rule #2
If the same door is opened anytime from Sunset -30 to Sunrise, sends notification and repeats every 10 mins until it's closed

I really like the 2 min delay if the door is opened after Sunset -30

@bertabcd1234, any chance you can create a rule like this for me with your great ideas?


Sure! Here's what I'm thinking:


Since I messed up the last one a bit, you might want to wait until appropriate adult supervision approves this attempt. :laughing:

TY very much, I'll get to testing it tonight



So last night, i intentionally left the garage door open well before sunset so the rule with run. It did, got the repeat notice 10 mins later... I closed the door and the notice stopped.

Any thoughts on why the rule still says it's repeating?

Apparently it's been repeating every 10 mins since last night, next run is scheduled here in a few mins

And this is what's in the log

I just went into the rule and enabled logging, selected Update Rule and now it's not repeating and it's not scheduled to run...

Thanks in advance

No, but perhaps I'm missing something. Maybe someone with better eyes than me could see a reason. (Is the door firing an "open" event multiple times, by chance? Even then from what I see it should still be cancelled when state changes to anything else.)

If this keeps happening, you could add a "Stop rule Actions" to the ELSE; my (documentation-informed) interpretation of this is that it would both cancel the delay and stop the repetition, so it might be all you need there, but adding it in top of everything else too doesn't seem like it could hurt. I haven't had a chance to play with this myself to see how it really behaves.

Actually in this case, the door was opened prior to Sunset -30 and only 1 open event was recorded in the log.

I will add a Stop Rules Action to the else section to see if that helps, unless I get additional feed back from others


@bravenel, can I get your input here?

Use case:
If the garage door is open at Sunset -30, send message, repeat every 10 mins until it's closed.
Or if the garage door changes to open anytime between sunset -30 and sunrise, pause 2 mins (in case we were just going in/out) then send message, repeat every 10 mins until it's closed.

Here is what was written for me and after many attempts at this... still having some issues

2 days go, I intentionally left the door open so the rule would be triggered at sunset -30, worked great, repeated as designed until i closed the door, messages stopped. The next day I noticed the rule was still repeating every 10 mins but wasn't receiving any notifications, see above posts.

Yesterday I went in, turned on logging, selected to Update Rule, repeating stopped and then last night, again with the door open, I didn't get any notification at all.

Here is what the log shows at 10pm when I closed the door, nothing is logged prior to that even though the door was opened well before sunset -30

I'm lost, what do you suggest?
Thanks in advance

OK, I think this is working pretty well,

One thing that I can't seem to figure out is this

When the contact is opened the first time, the notification is delayed for just over 20 seconds, not the 10 seconds as I would expect. Once the first notification comes in, each subsequent notification does arrive every 10 seconds until the contact is closed.

Why is the first notification delayed for 20 seconds?

@bravenel, Edit: spoke to soon, still wont cancel
Is anyone else having issues with cancelling a repeating action?

Thanks in advance

Why do you have Cancel Delayed Actions but your delay does not have Cancel selected?

Just an oversight :frowning:


Looks like your "(end) repeat" isn't closed before your "else." I haven't tried anything like this myself so can't speak to the behavior, but it doesn't seem like it should would work (I could be wrong). Perhaps that is part of the problem.

In related news, I've seen a lot of people writing rules likely this, often with some mistake in the logic. Maybe Hubitat could add something to the built-in Notifications app that enables users to keep getting notified if something stays a certain way, as well as only get notified after a delay if the condition is still met? (Part of this may already exist; I can't remember.) Seems like it would save a lot of people some effort. :slight_smile:

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.