Lights on w/ door sensor, off after no motion

Wondering if anyone has set anything up like this.

I have a light that turns on when a door is open. I have a motion detector in the room, so the light should stay on for as long as there’s motion in the room, even if the door has been closed. If there’s no motion after 5 minutes, the light can turn off.

I’ve tried this via Smart Lighting, but it gets stuck if the light turns on at the wrong time during the motion update.

Wait wait hang on, I think I got it:

Any of Garage Entrance or Garage/Basement Entrance contact changes to open
Garage Motion Detector changes to active
Turn on Garage Light

Garage Motion Detector stays inactive for 3 minutes
Turn off Garage Light

Seems to work like a charm…

1 Like

I have my front hall light set up with SmartLighting exactly as you describe and it works fine.

SL 1 If door opens turn on light

SL 2 If motion in hall turn on light, if no motion after 5 minutes turn off light.

I’m not sure I understand.

The light on if door opens is actually not needed, since if door opens it will trigger the motion sensor anyways.

What’s the reason for the XOR instead of a regular OR?

Also, does your But If section evaluate when the contact triggers the light without triggering motion?

XOR is “and/or”, right? If the light goes off while I’m in the room because I was hidden under the car for 3 minutes, I want it to turn back on if I trigger motion.

My understanding is that XOR means “one or the other but not both” (XOR = Exclusive Or). And/Or is inherent in the standard OR, meaning either or both can be true.

If I follow your logic, you enter a room, light goes on. Stays on 5 minutes. You leave room. Within those 5 minutes, you re-enter the room. Should the lights a) reset for another 5 minutes or b) continue counting down the original 5 minutes?

Check out:

1 Like

If you refer to ‘a)’ where the lights reset for another 5 minutes when motion is detected, then you can use a version of my piston NightlightPro. You will need to know how to code some in CoRE, but pretty easy.

Before starting piston, set CoRE for expert mode: Settings->ExpertFeatures turn ON Expert Mode

Here are two views of the same piston.

1 Like

Hey, thanks. Is there a reason why I see a lot of people skipping the “THEN” part, and just doing a “when true, when false” subroutine?

Programing preference, more power/options, more control.

1 Like