Lights on when arriving after sunset & off after set minutes

Hi,

I am new to the SmartThings community and would like to have my outdoor lights automatically turn on when I arrive at home between sunset and sunrise and turn off after a set amount of minutes. I found this SmartApp that does the first half of my ideal setup: https://github.com/625alex/SmartThings/blob/master/apps/LightsOnArrival.groovy but it doesn’t turn off the lights. If you know how to write a SmartApp please help me out. I tried the different mode setup but it doesn’t work for me as they overlap.

Thank you

I don’t think you need anything special. In the app:

Tap Lights & Switches
Tap the gear icon
Tap the light you want to come on
Tap turn on when people arrive
Select the people, tap turn off after a duration and set the duration
Tap more options and set only during a certain time to something like 5pm to 5am.

Save and done.

Repeat as needed for other lights. It doesn’t use the sunset setting, but if you give yourself an extra hour or two on either side, you’ll be good year round.

1 Like

I used SmartThings Sunrise/Sunset (Mode Magic). It shows as an option under ‘Convenience’ when you go hit the + button from your dashboard. It turns on all my outdoor lights at sunset and then turns them off at sunrise. You can even specify offsets, ie turn them off 3 hours before sunrise.

Chris

Although using hard-coded times in place of a sunset/sunrise time is a workaround, it isn’t very good in northern climates where the sunset can vary over five hours through the course of the year. What I would like to see in the readily available SmartApp is a sunset/sunrise time range for turning on lights when someone arrives.

Yes, I agree and adding a time range to this: https://github.com/625alex/SmartThings/blob/master/apps/LightsOnArrival.groovy1 b would be helpful if someone can do it.

@cdallum I have broached this subject in the past as I am north enough to get frustrated with changing set times in the fall and spring. Just note that the Sunrise/Sunset app Smart Nightlight that does this perfectly but it does not work with modes properly; only works for one day. I have emailed tech support and they say it’s old code and needs updating to work reliably; they will get to it…

A dedicated SmartApp for this feature would be beneficial. If someone could help us out with this I would appreciate it

I have this set up with all off-the-shelf apps and no custom work. At least for me, the sunrise/sunset app is working with modes reasonably well. We have four modes: Day home; day away; night home; night away. The sunrise/sunset app changes modes from day to night and vice versa; our presence detectors control home to away. So, the relevant app only triggers on arrival when in Night Home or Night Away Modes, and turns off after 5 minutes.

Very interesting @matt. I tried with no success on 2 different occasions with 3 different lights. It would behave one day and then after that the lights would come on no matter what mode I was in when I created movement. Looked in the code and there isn’t anything which discerns mode state, maybe that is handled in a higher level of functionality and it just doesn’t like me. :frowning:

@daven – you mention movement; if you’re using a motion detector it is a different set-up than mine. Just for reference for anyone reading the thread:

[Edit: read @evanbeek’s comment above. It’s clearer than my text was.]

As you go through the menu for creating the app, one of the options is “Turn light on when people arrive”. The last menu option allows you to customize for things like “turn off after [x] minutes” and “Only during a specific time” or “Only When Mode Is…”

If you’ve set your Modes to switch from day to night modes, with Sunrise/Sunset, you can limit the light to only turn on at a sunset-driven Night mode. Sunrise/Sunset is set by region and thus calibrated to local conditions.

I have zero coding skills and was still able to make this work; but I’m not using the “Smart Nightlight” app. If you cannot get the modes to work, perhaps contact support?

Hi,

I would like to revisit this topic, now that SmartThing’s added a new Sunset and Sunrise to the SmartApp Developer’s Guide. The different mode will not work in my setup, so a SmartApp that allows the lights to turn on if a door is open after sunset and turn off after (5 min, etc…) would be helpful. Have any of you found a solution to this yet?

Thank you

A couple of questions with that code:

I run into an issue with this code because it asks for a location, but the drop down doesn’t show any locations for me to choose. Am I missing something?

How does this know when sunset and sunrise are? Is there some sensor that “capability.illuminanceMeasurement” requires, or is it doing it off of some location based calculation?

Thanks.

Use the Smartlighting App and configure the setting Sunset to Sunrise on arrival.