[RELEASE] Left in the Dark - Lights turn on with motion if an automation turned them off

This is a simple app that is meant to solve the following situation: If you have an automation that turns lights off after x minutes of inactivity, and you are still in the room (just not moving around), you can immediately move around a little to turn the lights back on. Limited use case, but I created it for myself and why not share it. :slightly_smiling:

I did do this in Rule Machine initially, but it required several rules to get it working and still couldn’t do things exactly how I wanted. It didn’t take much time to put this together and is a more elegant solution.

The App has a couple things to prevent false positives:

  1. It has to be an automation that triggers the light being turned off. If you turn it
    off at the switch or manually through the app, then it won’t activate.
  2. There is a configurable timeout. This timeout starts once the light is turned off.
    The default is 60 seconds, so if motion is activated more than 60 seconds after the
    lights are turned off, then it won’t turn them back on.

The App is meant to be configured with light & motion sensor “pairs”. The app refers to the “pairs” as “rooms” as I figured that would be the most common use case, but it is really just an “area” of a home.


That’s awesome and I can see some good uses for it.

I have a question though,

I use rule machine and I have my lights activate in motion with a pending cancellable off. The absurd time out at 15 sec and 30 sec. Once they pick up motion again the turn off timer is reset.

What does this one do that will help me?

None of this is meant derogatory. I’m trying to understand use case and if it improves on what I use them I’m all over it.


Sorry, but what does that mean? I do not use my motions to turn lights on and do not intend to at this point. Too many scenarios where I wouldn’t want the lights to come on with motion. I use Amazon Echos to turn lights on hands free.

If I did have them turn on with motion I wouldn’t need this app I suppose.

What this means is that when motion stops a timer starts that turns then off. If motion is sensed before the timer ends, then the timer is cancelled, only to restart when motion stops again.

I misunderstood what you meant. I took it to mean you had motion active lights that were running of. You meant automations, as in a programmed time on and off.

Still a great app. Thank you for contributing to the community.

Thanks, I know it is a limited use case, but wanted to put it out there anyway. If anything else, I like how I did the interface on the app (to be a little self indulgent :wink: ). Other’s mind find a good use for that.

1 Like

Made a small update today to remove the use of the SmartThings scheduler. Made it more reliable and I was able to remove quite a bit of code.

You should make a sister app too: Right in the dark. Politically correct, I’d say ;))))

Interesting approach to a common problem, nice!

1 Like

This is neat! I don’t know how I missed it. Works perfectly for my set up. Thanks for sharing…


Thanks guys! I know it is kind of a silly app, but it solves a problem that I would occasionally run into.

1 Like

Yes, I really like your approach to avoid the runin(). That’s a nice touch!

Hey Eric, your app gained big xAF. My wife doesn’t like the lights to come on with motion is certain rooms, but my kids always leave the lights on. So, I use your app in case someone gets caught in the dark unexpectedly. Works perfect. One thing though, I meant to look through your code, for some reason it doesn’t work with dimmers. Do you know why?

Can you turn on the debug logging and post some of the logs up?

Done, I’ll post something tonight…

Here it is, not much to see. Kitchen should have turned on

So I am not seeing a log entry for the light in the kitchen (it looks like what is labeled Kitchen is the motion sensor, right?). I am subscribing to switch off events from the selected lights:

subscribe(settings[“lights_${i}”], “switch.off”, lightEvent)

Can you look in the lights “recently” tab and see if it is saying the light is off? Also, what is the brand and which device handler are you using?

I was just doing that too…

So the dimmer doesn’t have device/digital. We need to figure another way?!

I found an issue that I can see causing a problem if the dimmer takes a few seconds to ramp down after the off command is sent to it. Fixed that. Also, I added much better logging so give that version a shot.

1 Like

And, and…and it works like a pro! Thanks for your quick fix.

1 Like