Turn off after motion stops

Smart Lights has a functionality missing that many people use, a function that was available in Lights & Switches V1. The missing function is to specify how many minutes after motion stops to turn something off. This functionality is there if you use Smart Lights to turn on a light with motion, and then turn it off when motion stops. But if you only want to turn something off some number of minutes after motion stops, where it was turned on by some other means, that functionality is missing. I’m sure that SmartThings will fix this omission soon.

EDITED: ST has fixed this omission in mobile app V2.0.4. Smart Lighting can now do this function. As of 10/24/15. However, this is only true for hub V1 users. It is still not available for hub V2

In the meantime, this app provides that functionality:


Plus the turn off after motions stops in SL is looking at the very first motion stops.

So in my kitchen I use motion to turn on undercabinet LEDs. I have it set to turn off 5 minutes after motion stops. If you allow motion to stop it will turn off regardless of motion occurring again.

Prior to the SL app as long as motion occurred again after stopping the lights would not turn off?


I was just trying to setup some new lights and noticed this as well.

I just created my account for a similar issue. I’ve got a light that turns on if the motion sensor is activated, and then the light turns off 3 minutes after motion stops.

That’s perfect, but my problem is that if the light is already on, and the motion sensor is tripped, it will still shut off the light after motion stops. So if the light is already on, I want it to stay on regardless of motion. Any idea how to fix this?

For that scenario, turn off the “Tun Off After” option and the light will stay on.

This has been discussed before. You need a custom app to do this; Smart Lights doesn’t have a simple mechanism to condition motion-off on the prior state of the lights. Here is an example app that does this. It would replace the Smart Lights automation to turn the lights on with motion and off after x minutes. If the lights are already on when motion is sensed, it will not allow motion inactive to turn them off. You would have to turn the lights off with the switch to restore normal functioning of the lights-off when motion stops.


I contacted support about this issue. Their response was to configure the light to turn on based on motion and then the delay option is available. Not what I wanted.

This did the trick for me, thank you!

HaHa, there is an unintended consequence of that particular app: If you haven’t intentionally disabled motion, but leave the room for more than 15 seconds, and then return before the lights turn off, then motion-off will be disabled. There is not a simple fix for that “feature”, other than just turning the lights off with the switch.

There is a different approach that I’ve used that involves a virtual switch, and some other mechanism to turn that switch on and off (like a Routine or a Minimote). The virtual switch, if on, disables motion control for those lights. If turned off, motion control is enabled.

With Hub V1 things worked perfectly for me. The lights would not turn off until motion stopped for the final time and with the delay.
The app is no longer available and unfortunately I didn’t write down the app name.

Thanks @bravenel for your smartapps. I use this quite a lot on v1 hub and thanks that you make it available for v2 hub.

have question on precedence, i.e i add this smartapps “turn off after motion stops” and your other smartapps “turn off after some minutes”, which one will take precedence, will the switch turned off due to no motion or due to x minutes lapse ?

I also try to test this apps with disconnecting the v2 hub from the network to simulate internet failure, at one point, the switch remained ON even though time lapse the configured minutes with no motion detected. I will try again to see if this issue reproduced with your smart apps.

There is no precedence. Both apps have their own event subscriptions. When “Turn off after motion stops” gets a motion-inactive event, it starts a timer to turn off the lights (which would be cancelled by motion happening again). When “Turn off after some minutes” gets a lights-on event, it also starts a timer to turn off the lights. When either timer reaches its end, the lights turn off. A second timer may reach its end later, but that wouldn’t matter since the lights are already off at that point. If motion were to occur while the “Turn off after some minutes” timer is running, that would not stop that timer from turning off the lights.

These apps will not run without the internet on V2. Only Smart Lights runs locally.

So suppose i configure the “turn off after motion stops” for 30 minutes, and “turn off after some minutes” for 15 minutes. the switch will most likely be turned off with “turn off after some minutes” even though motion still detected ?

Ah that explain the things … wondering why it is not supported without internet, do you know another thread discussing this ? I thought only communication between cloud-to-cloud will be affected by internet down event for hubv2, this event still supposed to be locally manageable.

I’m experiencing weird behavior since upgrading to the new system too. I’m with @av8rdude, the old app worked perfectly, but the new one is stupid and is turning off lights even while we’re in the room and it detects motion.

I think what’s happening is that if you briefly leave the room and “motion stops” happens, it starts its timer (I have one set for 2 minutes, for example). Then you come back into the room, and picks up motion again, but it’s not canceling the timer – it still turns the lights off 2 minutes after the first “motion stops” event.

This whole hub v2 and iOS app “upgrade” has been nothing but a huge downgrade for me. Nothing’s working better than before, and there’s lots of stuff that’s worse. I can’t believe I keep giving ST money. No more.

Are you referring to Smart Lights, or to this app?

Sorry, I should have been more clear. I was referring to Smart Lights, and agreeing with you @bravenel that it is sorely needed in the “official” Smart Lights app. Thank you for your efforts to provide a solution.

I think it’s known by now that Smart Lights has some bugs. I don’t know how it handles that “cancelling the timer” bit. It used to be that every app used unschedule() to do that. But then ST started having all sorts of scheduling problems with overloaded servers, and unschedule() became unreliable. At that point I quit using it completely, and just used my own logic in apps to “cancel the timer” so to speak (cause the pending turn-off NOT to happen). I haven’t had any problems with motion-off triggering when it shouldn’t — well, once in a while I have, for unexplained reasons, although during periods of ST instability on a larger scale.

But, Smart Lights is supposed to run locally in V2 hub, so one would think that the scheduling would happen locally, and would be reliable. But I can tell you from experience that these apps can be tricky, and are prone to unobvious bugs. And, surprise surprise, ST has been known to release bugs in most releases.

Smart Lights is actually kinda stupid. And also embarrassing when I had everything set up only to have the lights turn off while I had guests over for dinner. I hope that ST is at least looking into fixing this.

In the meantime, if you want a motion lighting app that works, check this out:

1 Like

So … have been playing around on this app combination.
Seems if i use the smart light apps to turn on AND use @bravenel “turn off after motion stops” to turn it off, works well.
caveat internet must be up all time, otherwise the smart light will turn on, but will remain on until manually if internet is down.

Also with this combination, turning it on through smart light app, without configuring the action to turn off, respond much faster (turn on the switch right away).