Rule: Repeat action Syntax help

I had an older version of this rule, then I tried to add logic to it and it ceased working. I went back to where I started from, no luck. I deleted it, built a new one the way I had it before, (at least from my snapshot) and it still doesn't work...

Snapshots of rule and log below:


I don't think you need repeat action. A rule like what's pasted below should accomplish what you're trying to do:

Thanks, I assume in your example, any motion will 'interrupt/restart' the 1 min timer?

I am still baffled why it was working before and now it is not.

The rule you posted is missing an END-IF too... But the position of the one you have is odd -- it's somehow between the 2 stmts (vertically)... I'd expect it to show up there indented one more to the right, but :person_shrugging:

1 Like

That's what I thought too... but it won't let me add the other one...

Yes.

Could you post your original rule?

This rule is properly formed, whereas the rule you posted previously is quite mangled. With that said, you can greatly simplify your rule (and decrease the work hub has to do) by using a rule such as the one I posted.

1 Like

How would I un-mangle it? I must be missing something basic here.

(and I am using the wait expression, thank you very much!)

I confess I can't make heads or tails of what your intent is with the rules you've posted, but if it's what I suspect, then Ashok's example above would be an excellent solution.

If what he posted won't meet your needs, then I'd recommend explaining what your objective is in plain language here so that folks can offer other ideas.

1 Like

Perhaps there are situations when @james.michael.herber has observed that the "Garage Lights" do not turn off as anticipated?

If so, there are other ways to address that situation over using a repeat.

Editing the Actions as shown below should permit the rule to work as I think you want it to. However, I would recommend making the rule much more efficient.

2 Likes

I would think the Garage Lights Off needs to be after the "End Rep" as my guess is that he wants the lights to turn off if the sensor stays inactive through all the loops.

I would also suspect that if the sensor detects ativity, the lights will never turn off because the rule will not trigger again. The OP's "original" rule posted later has a trigger when the sensor reports inactive. This one does not. So -> Lights on Acitivity detected -> Exit Rule with no action. Lights are already on. So, it will not retrigger until the lights are turned off then on again.

I kinda think the better approach is the Lights on trigger with the wait for expression -.... you posted before. Or the Wait for event - Motion Inactive and stays that way for XX minutes would be the better options all the way around.

Also, I see that they were trying for 10 seconds between repeats. Not sure how many motion sensors actually report/reset that quickly. I think my FP 300 can be that fast. But I know for a fact that my Iris V2's do not.

2 Likes

Yup. I missed that!

2 Likes

@aaiyar Solution works great, and plan on using it. I’m just trying to figure out where it went wrong and how to fix it.

The intention is pretty simple, I have complicated it due to my ignorance on the functionality/capabilities of these functions.

Simple version: the light to turn off after a period of time of no motion. Coming from homekit, I learned for 'it' you wanted to do a repeat loop for it to check for motion periodically instead of just it seeing 'no motion'

Thank you everyone

More details, but not really consequential to the problem/solution: I have two sets of lights in garage. (well, one set that I turned into two) Parent is controlled by the switch. Child has a Shelly relay that is powered (line) by the parent*, and currently has no physical or smart switch (voice or app command only). I only want the I want the motion detector to turn on/off the "parent," and leave the "child" off unless I specify I want it on. I also want the off commands to act different; if the "parent" is only on, let no motion turn it off after 5 min or so. IF the "child" is on, I want a 90 minute 'wait' before turned off.

*I know this isn't ideal to turn line on/off on these devices.

2 Likes

Glad you got it squared!

I realize there are legit use cases out there for repeats and loops, but while I have a sizable number of rules (~100 in RM itself), I don't use them at all... They're too complicated for my taste.

If something demands more urgent attention, I just use either a High- or Emergency-level Pushover alert... That way Pushover handles all the desired nagging :sweat_smile:

But it's just me & the wife in our small house here, so I'm admittedly not trying to herd cats with unpredictable activity due to kids, other household members, lots of guests, etc. I realize all that would likely necessitate other means to keep things in check.

ETA - nuts, I realize notifications weren't the original topic here, but I drifted into those since they are a very common reason for using repeats & loops.

2 Likes

I have bright (overpowered?) lights in the garage, 600W of LED just on this circuit (200w on parent and 400w on child, And plan to add more...) Only want it for when I am doing projects We also have windows in the garage, and the wife is notorious for leaving things on.

Long story longer this automation is to prevent us from blinding the neighbors and keeping the electric bill down. (Wouldn't be here if she'd turn stuff off :rofl:

1 Like

I have a sort of similarish thing in our garage (but not on the level it sounds like you have going!)... Some lightweight 2-bay lighting is controlled by a RAB (dumb) ceiling-mounted motion sensor for basic/quick comings-&-goings, and then a wider set of lights for doing stuff in there that's tied to a smart switch.

That RAB motion sensor has always been totally reliable, so I don't worry about it at all, but I do have a rule that makes sure the smart switch is off if the service door's been closed & locked for 1 minute.

Since you have some pretty kickin' lighting loads out there, just make sure the controlling smart devices are all rated to handle 'em :+1:

I fully expect the Shelly controlling 400w of LED to not last (rated for 8A, 400W is ~3.5A) Yeah it is technically rated for ~2x that, but I suspect it will fuse the contacts in a relatively short time. Note Shelly doesn't publish if that 8A rating is for resistive or inductive (LED) load rating.

The wall switch is rated for 600w LED so at the limit there...

My next move is to have all the lights switched by individual relays, but I may wait until that single Shelly fails.