How can I make this work? Nightlight + Motion + Dimming + Time Delay


(Tuffcalc) #1

Hi everyone,

I’m in the process of building a new house and would like to add the following functionality:

  1. When the ambient lighting is low (i.e. during nighttime), when a motion sensor is triggered I would like certain lights to come on dimmed (say 10% of total brightness).

  2. After 5 minutes they should go out.

  3. Here is the kicker - if someone stays in a room and adjusts the lights to full brightness, I would like those lights to stay on at the user selected brightness. The lights should turn off after 3 hours if the user forgets to turn them off before retiring for the evening.

How can I get item 3 to work without the 5-minute nightlight delay shutting off the lights. On the same token, how can I make sure the brightness isn’t dimmed back to 10% when the motion sensor detects movement even though someone wishes to stay in the room and has manually selected the brightness?

Thanks for any help - I’m new to this and can’t seem to find this information via search.


(Brock) #2

You could have a mode when there’s motion – such as “Night - Motion” and another mode that is “Night - No Motion”. When there’s motion, turn leave the lights on for 3 hours. After 3 hours & X minutes of no motion, change it to “Night - No Motion” and dim the lights or shut the lights off.

Please let me know if this makes sense or not.

Edit: Oh, and as for the 5 minute auto off thing – have that set to only work during Night - No Motion.

Edit 2: Rethinking this whole thing…
Set mode to “Night” mode in low light
When there’s motion and low light in “Night” mode: dim the lights to 10% for 5 minutes.
When the user changes brightness: set mode to "Night - Set Brightness"
After 3 hours: set mode back to original “Night” mode


(Rob B) #3

Where are dimming controls in the app that can be set with modes and such? I am having trouble where my Hue lights are dim when they come on after being used in the nightlight feature overnight.


(Chrisb) #4

In a perfect world, this is actually very easy to do.

Look at my Hallway Light SmartApp. It does this right now based on time rather than ambient light, but you should be able to modify it easily enough.

This app looks for motion and if it sees it in a specific time range AND the light is off, it will execute the program (turn on at a dimmed level, then turn off at 5 minutes).

What you would need to do it two things:

First, change the time test to an ambient light level test.

Second, run a test when turning off to determine current level of light brightness. If a user changed the brightness level of 99%, then DON’T turn off, otherwise, turn off.

Now, of course we’re not in a perfect world. Here’s the issue I’ve run into: SmartThings doesn’t always notice that I’ve turned on my light fast enough. If I turn on my light to my upstairs hallway with my Aux switch SmartThings doesn’t “see” that the light is on right away (long complicated story… in short a switch can’t tell the Hub it’s been turned on unless that manufacturer subscribes to Lutron patent. SmartThings can “cheat” in someways, but not for Aux switches). This shouldn’t be a problem for you’re looking for changes to brightness level AFTER the program has run… and there’s a 5 minute window there so I think you’ll be okay.

Finally, grab my “improved power allowance” app and install that for 180 minutes. This will just automatically turn off the light after 3 hours when it’s been turned on.


(Tuffcalc) #5

Chris - any chance you can code this. I will pay!

I’ve never coded a thing in my life… and don’t even know where to start.


(Chrisb) #6

@tuffcalc,

I’ve kinda looked at this a little bit and I’m not sure how to do it honestly. I’ve got an app but it isn’t working properly for me. The big issue is that the switches are reporting a physical “on” press when the light is already on.

I think this goes back to a patent issue with some z-wave switches. I have to do more research and testing. I might be that this is doable with some switches but not others. It might be possible that it’s doable with all switches as long as they are within direct communication with the hub (as opposed to thru the mesh network), not 100% at this point.