From 609d12d6435c7548fe3993dfc7a07714b03ab5dd Mon Sep 17 00:00:00 2001 From: Seyed Amir Hossein Aqajari Date: Tue, 6 Aug 2019 18:34:11 -0700 Subject: [PATCH] Update turn-on-before-sunset.groovy --- official/turn-on-before-sunset.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/official/turn-on-before-sunset.groovy b/official/turn-on-before-sunset.groovy index a4ed25c..74bed7d 100644 --- a/official/turn-on-before-sunset.groovy +++ b/official/turn-on-before-sunset.groovy @@ -53,12 +53,12 @@ def sunsetTimeHandler(evt) { 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) -- 2.34.1