I've been racking my brain over this "simple" automation for almost half a day now. With some smart light switches and a motion sensor.
Here's what I'm trying to accomplish.
If bathroom light turns on wait X time to use motion sensor to see if motion is detected. If motion detected wait X time to check again for motion. If motion is detected then, again wait X time to check again for motion. Once no motion is detected within X time turn OFF lights.
My basic goal with this rule is to simply have hubitat turn off my bathroom lights if I forget to turn them off after no motion is detected after a couple of minutes to rule out any instances I might be standing still for a minute or 2. The following is what I've been playing around with. Different repeat, IF else, loops, etc. and I just can't get it.
So you basically are saying that you want no motion for X number of minutes before turning it off. You want this triggered by the light turning on? Is motion going to turn the light on, or only the switch? Would turning on this switch ever be done from a place where motion would not be detected before pushing the switch on?
It sounds like you want to leverage some combination of wait for event/expression, but would love to know a little more as mentioned above.
Here's an option that I believe should work. The motion sensor won't attempt to turn off the lights if either (or both) light switch isn't on first.
Motion Sensor active
Mando's Sink Light, Mercedes Sink Light any turns on
Actions to Run:
IF (Mando's Sink Light, Mercedes Sink Light all off) Exit Rule
Wait for Expression: Motion Sensor inactive
Wait for event: timeout 0:02:00
Off: Mando's Sink Light, Mercedes Sink Light
Motion detection interval is controlled by the device.
Seems like you would be be better served by basic rule with a wait until rule such as:
In theory only the light switch should activate this automation. There should not be/ i don't want there to be times when motion turns on the light switch before being pressed.
I want my lights turning on physically to be the trigger for this rule to execute.
I think i see what you mean here but won't that first OR run the rule if motion IS detected?. I don't want motion to be the trigger for the rule id like only the physical light switch being ON to start the rule.
Correct i think that detection interval is what has been giving me problems. It's really short and i basically want to increase that time if motion is detected within that interval. So after the lights turn on wait X time to check for motion. If motion is detected withing X time then wait X time again to check for no motion. Repeat until no motion is detected for X time.
Look at the inbuilt motion lighting app. To be honest the fact that your lights turn on isn't important your real use case is motion stops turn off the lights if they are on. Motion lighting takes care of that easily.
You can make anything you want to be the trigger I just threw it in there. The rule doesn't require anything actually its just watching for when motion stops.
@armandohern77 Yes, motion will trigger the rule but the conditional action will prevent the rule from doing anything, other than canceling the waits. This is the equivalent of adding a restriction to the rule. The rule only "works" if either or both light switches are on.
The simplest IMO would be just to use the wait for expression no motion with a duration. Although as mentioned above I think the motion and lighting app or basic rules can probably do this as well.
Wait for expression Motion sensor inactive: duration 2 minutes.
turn light off
Yes, there are various ways to accomplish this. Rather than check multiple times for inactivity you could use Motion Lighting and increase the delay time. I had an issue in my Laundry room where my wife would complain about the lights going off while she was in there. I just increased the delay to 10 minutes and this solved it. If there is any motion detected within the 10 minutes it resets the trigger.....
I didn’t see it mentioned, but whenever I use RM for motion lighting, I do this:
Cancel delayed action,
Turn off lights: delayed 2 minutes.
This runs every time the trigger device is active and resets the delayed off action.
This has so far done what I was looking for. I was pretty much in the same boat. Fiance forgets to turn off lights so I was using the motion sensor to turn them off but the event enunciation was to quick if we happen to be inside and stand still for a few seconds.
It sounds like this is what I was trying to do in RM but the motion app seems to have done the same trick.
I've taken a different approach to resolve this. I have a motion sensor in the bathroom that turns the light on when motion is detected. I also have a contact sensor on the door in this bathroom that turns the light off when it opens. Doing this it doesn't matter how long a person is in the bathroom the light will stay on until the door opens. To handle the times when someone goes in the bathroom and doesn't close the door I've setup a rule in RM to turn off the light if the motion detector in the hallway leading to the bathroom is triggered and the door is open. This approach has worked flawless for several months.