Error in Rule Machine for Delayed actions

Got this error:

when this rule fired tonight

My mode changed to Night at 8:42 also. I thought it was odd that the beep happened after the blinds moved.

@bravenel, any ideas on this one?

I'm seeing that error also. I can't show the rule because I changed it already to take the delays out. I thought it was something I did. :upside_down_face:

I though maybe the rule was being triggered twice in close succession, and the second iteration had no delays to cancel.

Yes, I wonder if your rule ended up having more than one instance running at the same time. Could it have been triggered a second time? If that happens, rules with IF-THEN-ELSE will throw this error, and one or both of the two instances won't work right. This is a peril of complex rules.

My advice is always going to be KISS. And don't go down the path of creating monster do-a-lot-of-things complex rules. My most complex rule compares two temperatures to decide when to turn a fan on and off. You guys are coming up with these monsters. Multiple triggers leading to multiple instances of the rule running at the same time will never work.

Break these big guys down into smaller chunks. RM gives you power, but you still have to consider what's going to happen from the various events and conditions.

1 Like

I too have been experiencing this issue, and have discussed it with Bruce. Based on what he believes is happening with the "multiple instances" of the same rule being active, I've tried the following to see if it helps. So far I haven't seen the error again, so maybe this is the solution, other than the obvious choice of breaking the rules apart?

I added a private boolean condition to stop the delayed/repeat action from triggering if the "else" condition hasn't occurred. I've only been testing this for about an hour. But the rule has been triggered several times and I haven't see the error return so far, so it's looking promising.

.

If my idea stated above doesn't work, that's going to be my next step.

Okay, I think I see what you mean... I think if I remove one trigger it'll work. The dat/night switch is what kicks the mode change so I don't need both as triggers.... But I need the complex if part. That shouldn't matter if only one instance is running at a time, right?

HE and RM noob here, coming over from ST. I had a simple rule in ST that worked great to put house in Night mode once motion sensors (we have a bunch) all stay dormant for awhile. I wrote this simple rule using RM. It doesn't work. What did I do wrong? Appreciate any ideas from my forefathers.

There's also a restriction on the rule that it only runs when the house is in Evening mode (which it is every night at sunset).

You need an ELSE statement to cancel the other action. Otherwise, as soon as all the motion sensors are active it will set mode to asleep. Something like:
ELSE-IF: Any motion sensor active, cancel delayed.

But don't you also want to have another clause in your IF part for what the current mode is? Or what time time of day is? If you are gone in the middle of the afternoon, you want the house to go into Asleep mode?

Personally, I change mode to asleep manually with a button. A lot more reliable.

Hey Ryan, appreciate the advice. The wife and I have 4 teens and a mother-in-law -- so far us, motion has been uber reliable! And I do have this rule restricted to "Evening" mode and after 900pm, so it's all good at least for us. A button is waayyy too much work for me lol.

Anyway, I think this is what you're saying, correct?

If it's only ever going to be the two things, you can just have an IF and then ELSE....the else always happens if the IF doesn't. But since yours are exactly opposite, then you can use ELSE. I was thinking you'd have the rule a condition in the IF part.

1 Like

Yeah makes sense. Alright, I'm going with this. Thanks and gnight.

1 Like

you also don’t have a trigger on that rule, so unless you are calling it from another rule, it is never going to run.

You need to add the trigger “motion sensors changed”

RM4 can’t have a triggerless rule?

And, as a practical matter, this rule should fire when a bunch of sensors all remain dormant, so how would one trigger such a scenario (the absence of change)?

Unless you manually call the rule, you need triggers. When the trigger happens, your Actions section runs. That's where you can check to see if all the sensors are inactive. (Because you're checking for that there, you don't need to worry about only triggering when all sensors are inactive. In fact, that wouldn't work here: you need to respond to both activity and inactivity so activity can cancel the timer.)

Alternatively phrased, this isn't webCoRE: your actions section doesn't subscribe to any device events. You do that yourself with triggers. :slight_smile:

Your triggers are any of the sensors changing.

Thanks guys. So I get now that Triggers are a requirement. Check.

What I don’t get is how you trigger a condition that is essentially “All Selected Devices Record No Events”. Imagine a scenario where no motions are triggered all evening. Once the restrictions are satisfied, I still want the Mode to change (because all motion sensors remain inactive). But in such a scenario no motions would have changed in any way, so the action doesn’t fire because the trigger isn’t satisfied?

correct. presumably you only want this to happen after a certain time? in that case i would the triggers as:

certain time
or
all motion sensors changed

then if there is motion, it won’t evaluate the rule until all the motion sensors are inactive. or if there is never any motion, it will evaluate the rule at that time.

So what do you actually want to trigger that change? You can use a "motion changed" trigger with an hour or two or whatever delay in your actions to make something run when nothing has happened for a while. You could also use a specific time as a trigger and then check for motion in your actions. Something has to make it happen, but "nothing" counts as something if you think about it the right way. :slight_smile:

OK I think I get it. Right now I have a time restriction that starts at 9pm. If I switch the restriction to a trigger (trigger = it’s 9pm), then condition will be satisfied once all motions are dormant for a while after 9pm. Sound right?

My problem with a trigger for this use case is that I can’t assume any motion event.

that’s why you want to use an “or” operand like I gave in my example above. you want both time and motion to be triggers.