Motion Lighting on/off delay timer on motion inactive

Today I noticed this rule wasn't working as expected when the switch was manually turned off, while the timer was running for motion inactivity.

In the Actions chain...
Wait for Expression: Garage Motion 2, Garage Motion 3, Garage Motion 1, all motion inactive
--> Duration 20 minutes
Off: Garage Light
Device event shows the motion become active but the timer was still running in the duration from the previous action.

So, in essence, if the light was manually turned off, while the duration was running, it could not be re-triggered, until the duration completed.

Room Lighting-- I attempted this in RL but here is my issue on that end.
I only want the lights to trigger with motion at night OR if light is manually turned on at any time.
Lights to be triggered off if motion is not present for X amount of time no matter day or night.

Update--- I think this MAY work.....

Its not clear what you mean. Where is something getting "reset" in either rule? Nothing I see should stop your rule from re-triggering. A pending wait does not do this; in fact, a trigger event cancels a wait.

If you are having problems with a rule, the most helpful first step is typically to enable all logging and see what Logs show for the rule. Providing those here may help others if they are not helpful for you.

A description (in plain language, not Rule Machine terms) of what you actually want to happen would also be good to have. I think there is some of that above, but some parts aren't clear. For example, "motion not present" -- do you expect there to always be motion at some point (this is the easist scerio to handle--there are events to work with), or do you also need it to turn off it's just been on for 20 minutes?

1 Like

I made some correction and clarification In the original post.

The second RM instance I posted seems to work as intended in night time.I will need to test during day tomorrow to ensure the day portion works as intended as well.

--Night Time test on second RM post:
IF I shut the light off manually, during a duration on motion " inactive" in previous triggered event, the rule will re-fire upon motion detection.

-- Day Time test on second RM post;
TBD

No need to wait until tomorrow to test your logic. Change your end time of Sunrise to something else like 6:00 PM to prove your rule works then change it back. You can also simplify your rule. Since the Wait for events and Off actions are the same for both the IF and the ELSE-IF you can just use the following.

Actions to Run
IF (Time between Sunset-30 minutes and Sunrise) On: Garage Light
Wait for events: GM2, GM3, GM1 all motion inactive and stay that way for 0:20:00 OR Garage Light turns off
Off: Garage Light

Note that the IF is a simple condition. If it works for your between time condition, it should also work when it is not met.

@pseudonym - sorry - I was stepping away so I did not have time to change the end times to test day activity at night.

Per you example you sent, and as I believe the RM action chain runs.
When using conditional actions with IF statements, it runs the line until it find a true statement.

Actions to Run
IF ( Time between Sunset -30 minutes and sunrise )
On: Garage Light
Wait for Events: GM2, GM3, GM1 all motion inactive and stay that way for 0:20:00 Or Garage Light Turns off
Off: Garage Light

If I manually turned on the garage light during the day, wouldn't this rule not fire because its NOT the time above?
Or as I am now reading it while I type this, the Wait for event is not tied directly to the IF time so it will skip the IF time because its not true, resulting In the Wait event to verify next...

Room Lighting has per mode or time period settings. You would uncheck the 'Act' column for 'day' modes/times.

I have lots of similar RL instances as your scenario, here's one of mine. Using the "switches that determine all Lights are off" resets the app when the lights are manually turned off:

1 Like

This is the key. With the simple conditional being false, it will just move onto the next action. During day time, it would go:

1.) False to the time period...skip this action
2.) Wait for Event
3.) Turn off the light

Basically, the rule would run every time there is motion, but with the first action being false, it would not turn on the light via motion during the day time (it is outside of the time period). During the day time, if you flipped the switch, it would trigger the rule (via switch on in triggers), skip action 1, and move to the wait event.

1 Like

I got this to work finally. I had some time tonight to check on it.

IT does appear to have some redundancy on it but its working as expected..
I wonder if this could have been done easier and better in RL......

@bill.d
well, I am now going to need to try this...lol

Vary on mode settings. I would assume there would be a vary depend on time as well. Im very new to the RL app and started with the RM app.. Im now trying to move what I can to the RL app.

Room Lighting can be complex. The docs are pretty good:

Im not goin to lie, could use a little UI tweaking on the RL app.. Make it little more clear for the masses. :slight_smile:

Someone coming from ST but knew stringify in the past and others. Still little confusing.

You can simplify your rule by eliminating the ELSE-IF line and replacing it with an ELSE instead. You have already tested whether the time was between the two times listed and there's no need to do it again.

See the 5th post for a streamlined rule example...

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