def scheduleTurnOn(sunsetString) {
//get the Date value for the string
- def sunsetTime = Date.parse("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", sunsetString)
+ //def sunsetTime = Date.parse("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", sunsetString)
//calculate the offset
- def timeBeforeSunset = new Date(sunsetTime.time - (offset * 60 * 1000))
+ def timeBeforeSunset = new Date()
- log.debug "Scheduling for: $timeBeforeSunset (sunset is $sunsetTime)"
+ log.debug "Scheduling for: $timeBeforeSunset"
//schedule this to run one time
runOnce(timeBeforeSunset, turnOn)