Why won't this routine stop repeating when the door has been closed?

This Hubitat routine won't stop repeating (i.e. sounding the chime and sending announcements to the Echo Show 5) even after the door has been closed. What am I doing wrong?

I think if you change the ELSE-IF to a IF inside the first IF, and move the END-REP to the end of the actions above the final END-IF, I think it will then work. Once it's in the repeat you need to a way to get out.

IF OPEN
    Repeat
        IF CLOSED
            CANCEL, STOP
        END-IF
    END-REP
END-IF
1 Like

Personally I'd make it two rules. One with the trigger being open and one with the trigger being closed.

Perhaps my real problem is that I don't know the command to "CANCEL" or "STOP". I assumed that Hubitat "Exit Rule" command would accomplish that in my routine.

Based on you advice, I tried a modified routine that looks like this:

Surprisingly, the routine will now immediately stop when I close the door. The routine also restarts whenever I reopen the door. The potential bad news is that Hubitat will always report that this rule is in "(Repeating") status.

"Exit Rule" is often overused: it just stops running additional rule actions (useful as an easy out without wrapping all remaining actions in a conditional, just that one, for example), but it does not un-schedule anything currently in place or un-subscribe to anything the rule might be waiting on.

What you want is "Stop Repeating Actions." This is found under "Delay or Repeat Actions, Wait," the same place you created the repeat in the first place. But to make it work, you also need to mark the repeat as "stoppable."

EDIT: This looks about like what you had in your first rule. The example you see has the "stop" and conditional inside the repeat, but that's because that specific rule would have to be written with just the desired "starting" event (e.g., door open) as the trigger, so the way to stop it has to be inside the repeat. Your "changed" trigger should catch both cases, and the other half of your conditional should run--stopping the repeat--regardless. It looks like you just didn't mark it "stoppable." If that doesn't help, turning on at least trigger and action logging for your rule may help you figure it out.

2 Likes

Thanks for your help. The routine now seems to work perfectly and no longer hangs up in "(Repeating)" status.

1 Like

I missed that you didn't have your repeat as stoppable in that first example, that was your main problem. Looks like @bertabcd1234 got you on the right track though.