Repeating action continues after premise becomes false

Hey there,

just a short question: I've got a rule that alerts me, when the bathroom window is open, starting a track on my Google Nest after 5 Minutes, repeating every 2 Minutes. Right now, it is always repeating the action two times, after the premise becomes false. Is this a known problem, or did I do something wrong?

Here the Rule:

First I thought it was because of my contact sensor not updating quick enough (Sonoff Door and Windows sensor running the Driver from Oh-La-Labs), but I checked, and it isn't the case.

I mean, it is not that big of a deal, but I was just wondering why.

It won't check the predicate again after it's started running

1 Like

My understanding has always been that predicates only restricted the firing of triggers, but others, including Bruce can correct me if I am wrong on this.... So I would expect once an instance of a rule is triggered, the result of a predicate would not impact the execution of that rule.

3 Likes

No, no, there is a misunderstanding. I was talking about the premise that the repeating action stops. Yea, the predicate condition and the premise to stop repeating actions are the same, which make sense for the rule as a whole.

Could this be the problem?

The problem for me is more likely I haven't read your post in enough detail.... Not an uncommon situation.... Let me take another look...

Without me digging into the rule, the simplest thing I can add for now is that the predicate and the trigger only come into play as far as triggering the rule, once it is running, the actions are the only things that dictate behaviour, outside of external rules interferring.

So what closes the Badezimmerfenster while this rule is running?

I do. Badezimmerfester = Bathroom Window. :wink:

I feel like I offered assistance where I'm not as qualified as I thought I was :-). Happy to hypothesise with others here, but there may be more experienced rule makers than me who can offer assistance.

Is hubitat actually repeating the loop two more times, or is Google (which is often a law unto itself) just deciding to play it two more times for no reason?

It's the Hub. When I check the rule, it's always showing "repeating" even together with "required expression false".

Try moving the test for stop repeating actions to be the first thing after the loop starts, and see if that reduces the unwanted repeats by at least one repeat. [And have an END-REP as part of that conditional block too] - actually ignore this, I hadn't realised this was a block closing statement - not used it in a rule before. Confused it with stop repeats

You mean to change everything to:

If Badezimmerfenster Open > repeating action, Else If > Stopp repeating action

Something like that?

Well I meant put the instructions to play the sound after the entire If block, though you could try putting them into the block too! That's an idea. Also try an End-if after the test. Not sure if it's required after only one instruction but Rule Machine might prefer it

@Vincent_The_Staat This might actually be the issue. You can do a one-line conditional but it's the "simple conditional" selection. I think in this case you need the endif. That's why the repeat/endrep looks unbalanced.

I would try changing it to the following and see if it works.

.
.
.
Set Volume ........
END-REP
END-IF
IF xxxxxx Closed
THEN
Stop repeating actions
END-IF.

Clone your rule and stop the original and then changed the cloned rule to my suggestion to see if it works.

The rule will repeat your notification one more time after the window is closed because the check for it is at the end of the repeat. As others have suggested, move the IF-THEN to before the Set Volume action and it should stop the notification after the window closes.

Is it possible that you have multiple instance of this rule running? I can see Humidity < 60 triggering more than one instance of this rule and having more than one Repeat running at a time. Logs of this rule would be helpful.

1 Like

Good point!

If I try writing it that way, I get an error right in the editing section. END-REP is supposed to be the last part of a repeating action.

Yes I have. The thought process was, that if someone opens the window after having a No. 2, that the rule wouldn't start firing right away. So delaying the repeating action for 5 minutes for fresh air reasons was the logical choice for me. Also, 60% air humidity is a nice trigger but for closing the window still a little early, so giving the rule 5 more minutes should help with that, too.

Within the repeating action, I have volume up and down, so I can hear the warning but have my speaker back to normal volume after the RA. I guess I can change that, so that it isn't constantly regulating the volume up and down.