When Motion is not detected Turning Off Lights


#1

1) Give a description of the problem
I want to set a “turn off light” function using a smarthings motion sensor and Ikea Tradfri bulbs that will turn off lights if no motion is detected after a set amount of time (for testing I am using 20 seconds). This should be regardless of if the motion sensor saw any movement prior. e.g. no one goes in room, but the app is used to turn the lights on, then it will auto turn the lights back off after 1 mins due to no motion.

2) What is the expected behaviour?
If lights are on, after 20 seconds of no motion, not counted from last “active” then lights should turn off.

3) What is happening/not happening?
The lights turn off after 20 seconds from last active state of sensor. IF you turn them back on again using voice command / app then they stay on. If the sensor never sees motion they stay on indefinitely.

4) Post a Green Snapshot of the pistonimage

I understand that the sensor may not be polled as often as 20 seconds in an “inactive” state, but I have waited as long as 20 mins so far without the lights turning off.


#2

If the state of your motion sensor does not change (it does not sense motion), then the piston will not be triggered. If you turn on the lights using a voice command / app, then the light will not turn off again until the motion sensor is triggered with motion (or your turn it off).


#3

You’ll need a variable that tracks if the light is turned on with motion so you can program around when light is turned on by an app.


#4

Is there any way around this?

Ultimately I am looking to turn on our outside lights at a certain time say at sunset. And have them stay on until a set time e.g. 10pm, at which point I want them to automatically turn off if motion is not sensed for a couple of minutes. I currently have this done by having a ‘turn off’ scheduled at ten pm, and then a rule that turns them on with motion after this, however, I am aware we have accidentally turned them back on and they have been on all night. Also, we have been saying goodbye to guests on the doorstep around 9.59pm and the lights have gone off on us. Even if only for a moment.

I will add that I am new to Webcore, so apologise if this is a dumb question.


#5

No dumb questions :slight_smile: This piston can be written in many ways. As @eibyer said, if you are going to use a combination of motion/voice/switch to turn the light on and off, you will need a variable that keeps track of that. There are many examples of this method in this forum. Do a little digging. If you still have difficulty, check back in here. There are many of us here who will eagerly help you.


#6

Awesome, I am just writing a new ruleset for my hallway lights, as soon as I have finished it, I will start digging into variables and will be sure to reply here if I get stuck. Many Thanks


#7

Welcome to Webcore! You might look here for some inspiration.