Not working: "Wait for event: elapsed time of variable"

I have a 5.1 rule that's been working fine for a while, but it stopped working recently. I'm currently on latest version on a C5 (2.3.5.113) hoping it would resolve this issue, but it didn't help.

My rule has this logic to turn off the light after no motion activity:
Action: Wait for event: --> elapsed time: OccVar(0:20:00)
Off: MySwitch

OccVar is a variable that gets set incrementally larger as motion is repeated, starting at 20 seconds, going up to 20 minutes delay. For whatever reason this no longer moves to the next instruction after the elapsed time to turn off the switch. I can see in the logs that it's waiting for this line but doesn't log anything after 20 minutes. If the motion sensor triggers again, it runs the rule again.

I don't know if the timer is not working correctly, if the rule is running multiple times, causing multiple timers to accumulate, or something else is broken, but this rule stopped working correctly.

Also, the rule takes a long time to load (5-10 seconds), unlike before.

Waits are always cancelled by the rule being triggered,

I just tested this and it works as expected. Also, be aware that if the variable changes after the wait begins, that will not affect how long it waits. The duration in seconds is fetched from the variable when the wait action runs, and a scheduled job is created for that many seconds in the future.

I would suggest that you remove this rule and enter it again. See if that fixes it.

Good to know that the wait is cancelled on re-trigger. Wasn't sure if the timer would be accumulating.

The rule is a bit complex, so didn't want to go through that, but I'll try recreating and see if it fixes my issue.

Recreating the rule fixed the issue. Looking at the old rule via export, something was definitely broken with it. There were some malformed JSON entries with a lot of unexpected values.

Also, I ran into some issues while creating the new rule. Sometimes, adding a new rule will say Expression is broken, even though I did not add any yet. This occurs when I try to replace a conditional inside another conditional (either editing, which didn't work, or delete and insert). Not sure what causes it.

Also, if this issue occurs, I cannot insert an expression within the condition. It doesn't show me the option to select an action such as setting up an expression or selecting one. The only way around this was to create the conditional at the very end and slowly move it up into place (of course this rule needed to be set as the 2nd line within a 25 line rule). Having drag-n-drop for rule ordering would be nice!

1 Like

I like your objective/intention in this rule. Could be useful. When it finally settles down and works as you intend it would be of interest to see the specific line constructs that achieve your end.

Here's the rule. It basically tries to implement a progressive delay occupancy logic. If I'm just passing through, it'll turn off quickly. If I'm sitting in the room and it detects motion during that time, it'll keep delaying the turn off time in case I am stationary for a longer period of time. I use this to keep the room lights on while I'm on the computer.

1 Like

Looks like there might be some issue still with RM. My newly created rule was working fine since I re-created it, but is once again not getting past the wait. Also, the rule takes a while to load again. Looking at the export, it's again filled with values that didn't exist after re-creation.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.