Advice on Motion Triggered Lighting

I want to set a rule that turns of lights in a room if the motion sensor in there stays inactive for a certain amount of time.

Currently I have it set that if motion is inactive, turn of light after 5 minutes.
However, will this still happen if if motion is detected in that 5 minutes as the timer would have started?

Is there a way to cancel the timer if motion is detected, or how would be best to achieve what I am trying to?

This will do the job for you.
Use pending off OR wait 5 minutes and enable cancel on Truth change.
This way while there is motion the light will stay on.

3 Likes

Cheers will check that out, looks good

This works just as I wanted, thanks a lot @bobbles

I'd like to use this rule as well, but I'm having trouble figuring out how to create it.
As far as I can tell, you are checking on the motion sensor, and checking if the room has low light.
Then if those two conditions are met, turn the light on. But I don't understand the False condition. What is Pending Off?

Pending off means, if there's motion again, the 2 minute countdown starts over until there is no more motion.

Ah, that makes sense. I had made a single rule to turn off the lights if no motion was seen, and in my action I had it wait for a set time then turn off the light. It has been turning the light off almost at random though even if there is motion. Pending Off makes much more sense.

If you want to override and turn the light off immediately, you can put an or operator in the rule and point to a switch to turn the light off. Alternately, just use the Motion Lighting app. All that capability is in there too.

That's pretty neat, I didn't know that existed. How do you find out about all the features? I have been bumbling around the interface but find it difficult to learn. And the documentation seems to be lacking, or I'm bad at searching the documentation.

docs.hubitat.com or when you're in any of the apps, click the ? at the top right

1 Like

cool, thanks!

1 Like

Do you know how to do this in Rule 4.0? I can't figure out how to create a non-triggered rule.

Your trigger would be the motion sensor in this case. I have a few rules that trigger on "changed" rather than active or inactive. I then setup an if statement in the rule along the lines of:

IF (motion = active) THEN
   do something
ELSE
   do something else
END IF

However, I prefer the motion zones app for most things. In addition to combining multiple sensors into a single event it also handles all that "reset if new motion" logic for you.

I've been searching the forum to figure out how to set up the bathroom sensor to trigger our bathroom lights to turn off after the sensor is inactive for 4 minutes. If I understand correctly... when the lights are on and the sensor goes inactive.. at 4 minute time starts and once the timer expires the lights go off. My issue is that when the lights are on and the sensor goes inactive causing the timer to start... I have been unable to create a rule that would reset the 4-minute timer so that the lights will remain on.

Real-life example: My wife is in the bathroom putting on makeup, but has to walk out because one of our girls needed some help. (when my wife leaves to help our girl the sensor changes to inactive and the timer starts) My wife comes back into the bathroom (the sensor changes to active before the 4-minute timer has expired) but after a few minutes, the lights go off.

I haven't had success using the Motion Lighting App so I'm wanting to make this happen using Rule Machine. Would someone be down to look over my rule to see where I'm making mistakes? I'd really appreciate it.

36%20PM

Your rule looks correct to me. What makes it work is the "Cancel Delayed Actions" action coupled with the "Cancelable" flag set on your delay: that flag marks that action as eligible for cancellation, and the "Cancel Delayed Actions" is what makes that actually happen. Your delay is in the ELSE, which should run any time the sensor is inactive, and your cancellation is in the IF..., which runs when the sensor is active.

One thing you could consider: turn on logging for this rule (action logging would be the least you'd need, but all of them would be OK too). Then see what it thinks it's doing when motion goes active/inactive. If neither this rule nor Motion Lighting (which should also work) works for you, I'd suspect something else is wrong--maybe your sensor isn't accurately reporting events, or (perhaps more likely...what bulbs are you using?) your bulbs aren't responding to on/off and other commands appropriately.

Thanks @bertabcd1234! So after the rule not working for whatever reason, I decided to give the motion lighting app another try. I disabled it and re-enabled it and it's actually working like a charm. The issue I'm running into now is finding a way to set up the light switch to work the way it should. Here is the light switch we have in the bathroom.

The rules I had set up for this are below and they worked okay on their own, but when I started the Motion Lighting app back up -the response time on the light switch was delayed big time.

Is there a way in the Motion Lighting app to set up actions for buttons 2, and 3 on the dimmer switch. Here are my settings currently in the Motion Lighting App.

Thanks again for any help you can give me. I really appreciate it!!

I left button 2&3 rules set up in RM and deleted buttons 1&4. I then specified in ML to turn on/off lights with those buttons. Works like a charm, and no slowdown.
Edit: I see you have different setup for each. You also have “push buttons per mode” set up with levels instead of button numbers.

Thanks for the response @Ken_Fraleigh. I'll give that a try.

I've installed several more motion sensors and just updated to 2.2.4.156 and can no longer add the pending off, I'm also unable to clone the rule like I was before.
I can't use the motion zones app since I'm using the Fibaro smart implant and the Hubitat doesn't know that I have motion sensors with the Smart Implant.
How do I add the pending off feature now?

The name changed. Look for delay (cancelable).

Or use Simple Automation Rule, or Motion Lighting apps. They can do motion triggered lighting more simply than Rule Machine.

Or, try this more streamlined method:

Those Waits would be automatically canceled if the rule is retriggered by motion becoming active again. So that light won't turn off until 3 minutes after there has been no motion on any of the sensors.