Repeat & wait for condition/event ? Help pls

Can I pls have some help with repeat and wait for condition/event.

I have two presence sensors - Hubitat App, and my wifi. My wifi app check my presence every 1 minute. When I get home and connect to wifi, Hubitat does a few things, such as opening my garage door. I dont want to be standing outside waiting for Hubitat to realise I'm home, so when I hit the Hubitat app circle, I have a rule that refreshes my wifi rule to see if I'm present. I want to turn off the 10 second refresh when I arrive home, because it's a waste of hub resources. But I cant seem to figure out repeats and wait for condition.

What I'd like is that the repeat finishes when my wifi connects, so I've placed the END-REP after the wait for condition. I've tried both wait for condition/event and neither have stopped this rule. My wifi presence is indeed present, but it's not stopping the rule.

image

HE app arrived at 9:14:00pm
wifi arrived at 9:14:41pm

So, in theory it should have worked.

Here are the logs.

HE app triggered at 9:00pm

Wifi presence connected at 9:14:41

But it didnt get registered in the logs, or by the rule.
image

The wait is after the repeat loop....I think you are never leaving the repeat loop. Put another if statement inside the repeat, if Mike WiFi = present then stop repeating actions.

1 Like

Thanks. Makes sense now you've explained it. I guess I could have wait for event/condition within the repeat?

I've modified the rule as per your suggestion.

I haven't used Waits yet, but I think if you use a wait inside the repeat, it will never actually repeat because it's waiting for the event before allowing the repeat to continue. Get rid of the wait and use a nested If.

1 Like

I also think your first condition of "Mike arrives" shouldn't be there, that's inherent in your trigger. Try something like this:

Mind blown.

I usually run my rules pretty lean. Huge mistake there. Thanks again.

1 Like

Do I want it stoppable? I'd imagine so.

Honestly I'm not sure what "stoppable" does. I've gotten into the habit of using the explicit "cancel timed actions" or "stop repeating" which seems to work regardless of the stoppable setting. No reason not to set it that way though.

1 Like

Yes, it has to be stoppable, otherwise it will never stop. You also want to have the stop repeating inside of the repeat but before the wait. Otherwise, the repeat will not end. So, your order of the rule would be:

Repeat every 10 seconds stoppable.
     Refresh Presence
     wait for presence present
     stop repeat actions
end-rpt
All other actions you want to execute.

Otherwise you'll never get to the stop of the repeat actions.

1 Like