Webcore Help with Turning off Light when no Motion

(Joseph Fattizzi) #1

I have a motion sensor and a kitchen light hooked up via a smart wall switch. When someone turns on the light, i want it to go off 5 minutes after no motion is detected. But if motion occurs within that 5 minutes, the timer should restart.

How can I do this!?

Going crazy trying to get it to work.

(Bob) #2

This will do it.
Just import using the code and put in your devices.
This has a lux level as part of the conditions.
EDIT: Change the set level to turn on.
EDIT 2: Changed it for you. Import this one.


Curious why you have command optimization disabled on this one?

(Bob) #4

The light switches that I use are LightwaveRF which are stateless unfortunately.
So their state could have changed and ST would not know.
Because of that I disable command optimisation so that the commands will always run whether needed or not.


That would explain it, thanks.

(Joseph Fattizzi) #6

Thank You. I dont need the lights to turn on though. I only want them to turn off if there is no motion. So if my wife turns on the lights and then leaves the room i want them to turn off after 5 minutes.

If she turns them on, leaves the room and comes back 2 minutes later…the timer should go back to 5 minutes if there is no activity

(Bob) #7

Try this.

(Joseph Fattizzi) #8

Thank you. I will try it shortly.

(Bob) #9

Or this.
Lots of ways to skin a cat!!! :wink:

(Dan Fox) #10

I have this piston that does exactly that.


How about this?


Thanks guys, this was a useful reference for me just now - nice to see a couple of different approaches as well.

(Tom Kalinoski) #13

What if there was never any motion to begin with. Meaning, my kids turned the light switch on, however, they never triggered the motion sensor. I’d still like to turn the light off if it was turned on manually, and the motion sensor didn’t sense any motion for 5 minutes.

(Nilanjan) #14

Has any approach worked? This seems to be a common need for everyone but I didn’t find a solution that people said that worked. My code is like this:

With this the light turns on correctly and also turns off after 2 minutes, but if I am still in the room it doesn’t reset the timer and I have to be in a dark room for about half a minute before it turns on again.

(540guy) #15

@binil98 I believe you need to add a condition where if motion is inactive for two minutes, then turn the light off.

Your piston at the moment is essentially set as a 2 minute countdown as soon as the light came on, to turn it back off, not factoring in any existing motion.