Controlling lights based on two motion sensors

Hi All - I have a rule that doesn't seem to be working as I think it should.

I have two garage bays - one for cars and one for a workshop and there is a wall separating them. I have a motion sensor in each. I want the lights to turn off when there is no motion in either garage for 10 minutes. That way when we drive in the lights turn on (via a separate rule) and then turn off after when we go into the house. However, if I'm working in the workshop or garage I want them to stay on while there is activity in either and then turn off after 10 minutes.

I created the following and it works inconsistently, leaving the lights on sometimes. What am I doing wrong?

One option that should work for your application is to use the built-in app "Zone Motion Controller". This would create a virtual motion aggregation zone that you would use in your rule.

Look at the documentation...Zone Motion Controller | Hubitat Documentation under "Create a Motion Aggregation Zone"

Quoting from the doc....." A Motion Aggregation Zone activates whenever any one of the motion sensors in a zone are activated, and it will remain active until all the motion sensors in the zone are no longer detecting movement and the Activity Timeout period has not expired."

Another option is the Room Lighting app, but you already have your rule setup so it would probably be easier to go ahead and set up a motion aggregation zone and use that in your rule.

1 Like

This rule would only work if there is motion on both sensors. If one motion sensor is already inactive, it would not send an event for the wait to process. This would prevent your rule from reaching the Off command for the lights.

With the above said, @Sakman's suggestion is the way to go with your rule. Create a motion aggregation zone between the two sensors with an Activity Timeout of 10 minutes. This would basically create a virtual motion sensor that would turn inactive after 10 minutes of no motion. Either of your real sensors would trigger it and bypass the issues you are having. It would also simplify your rule to be:

Trigger: Virtual Motion sensor inactive
Action: Turn off Garage Lights.

2 Likes

Are the motion sensors wired in parallel? If so, activity with either one should keep the lights on and then you just have to have them turn off when no motion is sensed for your desired time. Many times you can set that time directly in the switch and don't need any additional automation.

Wow, that seems to be way too easy. I changed things and let us see what happens.

You shouldn't be triggering on motion changed, but rather on motion active.

1 Like

This is not correct. When using Wait for Event: motion inactive and one sensor sends an inactive event all sensors are evaluated. Additionally, the rule is using Wait for Expression which uses the sensor's condition (state). If both are inactive when the Wait is executed it will evaluate as true and proceed to the next action.

2 Likes

I appreciate the response as I did not realize this about expressions.

You might find it easier to use Room Lighting for this, instead of Rule Machine. It can do the logic you want, with turning the lights off, but keeping them on as long as there is motion.