Fridge Rule - Cant figure out the issue

trigger: Refridgerator Door changed

rule:
IF (Refridgerator Door open(F) [FALSE]) THEN
Delay 0:01:00
Repeat every 0:01:00 (stopable)
Notify iPhone X: 'Refridgerator Door Open at %time%'
END-REP
ELSE
Stop Repeating Actions
END-IF

It worked when I did a simple controlled test. But when the fridge is opened and closed several times within 1 min, it appears to get caught in the REPEAT loop, and I get constant notifications. On top of that, there appears to be several instances of the rule firing that gets caught in the loop.

While I know I can utilize the notification app to cover this scenario, I may want to create a more complex notification rule that increases frequency the longer the door stays open. And I really just want to know why it didnt work :slight_smile:

I think this is a dangerous combination. I worry about the repeated running of a rule. You need to have a cancel rule

if fridge is open then notify phone ".." delay 1 minute. cancelable
else if
fridge is closed then cancel delayed actions
end if
I you want the repeat in feel free to add it, but you need a way to cancel the rule when it's closed. Trigger is fine.

1 Like

but you need a way to cancel the rule when it's closed.

I figured I covered that when I have ELSE Stop Repeating Actions. To me, I should never get stuck in the loop when the door is closed, unless I'm understanding the "Stop Repeating Actions" line.

Your rule “stops repeating actions” that have not yet started if the door has closed quickly. When the delay ends, with the door closed, the repeat will begin and never end. Thus the need to make the delay cancellable in the IF, and the cancel delayed actions in the ELSE.

1 Like

Try something like this:

Trigger: Fridge Door opens

Actions:

Cancel Delayed Actions
Delay 0:01:00 (cancelable)
IF  (Fridge Door Open) Repeat 0:01:00 
  Notify iPhone X: "Fridge door open at %time%"
END-REP

If you use a simple conditional (just a one-line IF, not an IF (...) THEN) on a "repeat," it is essentially a "while" loop that just repeats while the IF's condition is true. You can see more examples in this thread: How to get Repeated Notifications using Rule Machine. Many people will also be thrilled to know that the next release of the Notifications app is slated to include a feature that will let you do repeated notifications without resorting to rules at all. :slight_smile:

5 Likes

Thanks everyone for the tips. I now get why it got stuck in that repeat loop.

3 Likes