Help with lighting rule with motion and contact sensor

I am trying to setup a rule that will turn on light if a contact sensor is open or if there is motion and then turn them off if the contact is closed and there is no motion for one minute. This is what I have and the turning off part is not working.

This would be the perfect situation to use Hubitat's Motion Lighting app.

It's not turning off because your IF condition -- contact closed and motion inactive -- will never be true after it's been triggered by at least one of those being false. The rules doesn't wait around for the IF to be true. It just turns the light on, then evaluates the IF (false), and ends.

Try changing your Trigger to "changed" so you're capturing both states.

I had that setup for motion but I added the contact sensor today and did not see a way to turn it off with just the contact. I have to walk a few feet into my garage before the motion sensor will kick in so if I open the door without entering the garage I did not see how to get it to turn off that way, that is why I am trying rule machine.

That worked, thanks

Even with the above changes, your rule won't quite be right--that one-minute delay is never cancelled, so you may get unexpected surprises in the form of "off" events you weren't expecting to happen due to new option or re-opening. There is a motion-lighting example in the Rule 4.0 docs that shows how this could work, minus the contact sensor that you could add in.

That being said, the Motion Lighting app, as suggested above, could also handle this--despite the name, it now supports contact sensors. If you do want to use Rule Machine, consider something like this instead:

Triggers: Contact sensor *changed* OR Motion Sensor *changed*


IF (Contact sensor open OR Motion sensor active) THEN
  On: Switch
  Cancel Delayed Actions
  Delay 0:01:00 (cancelable)
  Off: Switch

Note the addition of "cancelable" and "Cancel Delayed Actions" (which will cancel any delay marked as "cancelable").

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