For reference this is the project i am trying to edit a bit. http://build.smartthings.com/projects/frontdoormotiondetector/
I wasn’t sure if posting (I didn’t see forum thread already) or commenting was more appropriate but this seemed better for discussion. Anyhow my question is how to incorporate a schedule mechanism.
What i would like to do is set my porch to turn on at sunset +user picked variable in minutes from 0 and up. Then i would like the lights to stay on until 2nd user picked variable (Time to switch to motion control IE Original program).
So to boil it down i want to add 2 time user variables.
a +Sunset and a Stop Constant on time.
I think this would allow more flexibility in the app and provide security into the night as desired.
Below is a sample of my code additions i was working on but I have gotten stumped, still new to Groovy and ST platform. Any help would be appreciated. On adding the +time to Kris’s Sunset code, and fixing / adding the on constant until motion mode.
|||||||||||||
//Time Delay to set lights to constant on state after sunset. Could be Set 0 to whatever in minutes
section(“Time Delay After Sunset to Turn on Lights…”){
input “timeondelay”, “time”, title: “Time?”
}
//Time At Which constant state ceases and lights go into Motion Sensor Mode
section(“Time to turn lights Off and switch to motion…”){
input “timeoff”, “time”, title: “Time?”
}
|||||||||||||
def nightTime() {
if (light.currentSwitch == “off”){
(checkNighttime()) {
light.on()
} light.off(time, ${timeoff})
}