X-Git-Url: http://plrg.eecs.uci.edu/git/?p=smartapps.git;a=blobdiff_plain;f=official%2Fsunrise-sunset.groovy;h=f1d88e736c6c878aeebd725144f115dffbd9c04a;hp=417cce6367c526ac15535d2726cb13b48be50150;hb=609d12d6435c7548fe3993dfc7a07714b03ab5dd;hpb=3325c1b0cc49b9fbbc497cb3612f7aeff5263eca diff --git a/official/sunrise-sunset.groovy b/official/sunrise-sunset.groovy index 417cce6..f1d88e7 100755 --- a/official/sunrise-sunset.groovy +++ b/official/sunrise-sunset.groovy @@ -46,7 +46,7 @@ preferences { input "sunsetOffsetDir", "enum", title: "Before or After", required: false, options: ["Before","After"] } section ("Zip code (optional, defaults to location coordinates)...") { - input "zipCode", "text", required: false + input "zipCode1", "text", required: false } section( "Notifications" ) { input("recipients", "contact", title: "Send notifications to") { @@ -71,22 +71,26 @@ def initialize() { subscribe(location, "position", locationPositionChange) subscribe(location, "sunriseTime", sunriseSunsetTimeHandler) subscribe(location, "sunsetTime", sunriseSunsetTimeHandler) - - astroCheck() + + //astroCheck() } def locationPositionChange(evt) { log.trace "locationChange()" - astroCheck() + schedule("someTime", sunriseHandler) + schedule("someTime", sunsetHandler) + //astroCheck() } def sunriseSunsetTimeHandler(evt) { log.trace "sunriseSunsetTimeHandler()" - astroCheck() + schedule("someTime", sunriseHandler) + schedule("someTime", sunsetHandler) + //astroCheck() } def astroCheck() { - def s = getSunriseAndSunset(zipCode: zipCode, sunriseOffset: sunriseOffset, sunsetOffset: sunsetOffset) + def s = getSunriseAndSunset(zipCode: zipCode1, sunriseOffset: sunriseOffset, sunsetOffset: sunsetOffset) def now = new Date() def riseTime = s.sunrise