Rule with 3 motion sensors and time elapsed

Hi there im trying to do a rule without succes

i have a motion sensor on the door and other 2 motion sensors inside the room,2 main lights and a table lamp i want to:

IF the main lights are off AND there has been no motion in any of the 2 sensors inside the room for the last 5 minutes,then and only then turn on the table lamp when the motion sensor of the door detect someone

where im having troubles is in the¨no motion in the last X minutes on X sensors¨i dont know how to achive that.

i want this to avoid the lamp get turn on IF someone is on the room,but because the sensors sometimes do not detect when someone is in a still position ,thats why i want 5 minutes of margin without NO MOTION.

Any ideas?Thanks

Maybe this will give you some ideas. With this rule once the main light goes out the rule will wait for both motion sensors to stay inactive for 5 minutes. The problem may be if the motion is already inactive when the lights go out. Without knowing more specifics about how all lights get turned on and off this is just a example to get you started.

Note: you would also need to turn on the cancel pending actions when required expression becomes false, when setting up required expression.

1 Like

Have you tried using the Motion Lighting app?

1 Like

You need two rules. First rule creates a virtual switch that you can toggle on/off based on the motion of the two sensors in the room.

Please ignore my devices. The general gist is that there are two triggers for your new virtual switch. Motion on either sensor inside the room or inactive and stay for 5 minutes on both. These two triggers flip the status of a virtual switch.

Then create your second rule using the door sensor, main lights, and table lamp. You would want:

Required Expression: Virtual switch from Rule 1 be Off
Trigger: Motion on door sensor
Action: If main lights are off, turn on table lamp

If your inside room sensors have motion or are inactive for less than 5 minutes, the second rule would not run since the required expression is false.

1 Like

Have you looked into what the Zone Motion Controller app offers? A group of sensors as a Zone can be set to use Motion Aggregation, False Motion Reduction, or Triggered Activation. Use a created Zone in a Rule or Lighting routine instead of the sensors themselves.

That helped me resolve lights going out while present in garage/laundry. 3 sensors in a Motion Aggregation zone, with a 7 min. timeout works nicely for our activities. It might come in handy here - definitely maybe?

...bob t


Zone Motion Controller app (Motion Aggregation) would also be another way of solving this issue. If @Metrochan combines the inside the room sensors into one with an activity timeout of 5 minutes, that would also achieve the same affect. The rule is then fairly straightforward:

Required Expression: Combined sensor is inactive
Trigger: Door sensor becomes active
Action: If main lights off, turn on table lamp

The big thing to help the OP is combining the two motion sensors into a different virtual device (switch via rule machine or sensor via zone motion controller).


Hi¡ thanks i try to use your rule as idea but i had no luck :confused: i was missing something,i culdnt figure out what was, i will try to doing again later as an option and learning purpose ( i made posible my rule/idea with @jb10 help and the idea to use the ¨Zone Motion Controller app¨ and Motion Agregation

HI,i try but without succes, i couldnt figure parameter etc to how make mi idea posible,thanks anyway


Your idea work great,im still making test and testing and adding more parameters over the follow days but the rule as i was looking for, works great using Zone Motion Controller app and Motion Agregation,

if it hadn't been for you and @bob.t i I would not have tried the Zone Motion App,i always was thinking was a more basic app,but not and will help me maybe with other few ideas for the house that app

In what way would help doing that,combining the 2 motion sensors in a virtual device,to make it as a ¨extra accuracy¨¨ for the rule? excuse me,i dont understand very well that part
(my rule for now is make without any virtual device but still works great with your instructions)

So far my rule was created in the next way:
Install the Zone motion Controller
Create my zone with motion agregation:

and then create my rule:

i It hadn't occurred to me to use the app of Motion Zone, if it weren't for you and @JB10 I might still be struggling with how to make my rule work.i I always thought that app was more basic but looks pretty handy
Thanks for your idea and recomendation

1 Like

When my rule is 100% complete i will post it here :slight_smile:
Thanks again everyone who took some of your time to help

1 Like

@Metrochan It’s not about extra accuracy. The issue with your rule is the wanting no motion and staying that way for a period of time. For required expressions, motion can either be active or inactive. Inactive and stay is not possible, which is what you needed.

Because of the above issues, you needed a solution to help with the required expression. My solution turned your two sensors into a switch that could easily be used. @bob.t recommendation turned your two sensors into one with an extended timeout before showing as inactive. Both work with the require expression (on/off for a switch or active/inactive for a sensor) in a manner that can be used.

1 Like

Download the Hubitat app