X-Git-Url: http://plrg.eecs.uci.edu/git/?p=smartapps.git;a=blobdiff_plain;f=official%2Fsunrise-sunset.groovy;h=783684a58786b530e30740665e21a2399acad0f2;hp=417cce6367c526ac15535d2726cb13b48be50150;hb=413dcbf371a560eaed0440bb92a296d4585c90c6;hpb=3325c1b0cc49b9fbbc497cb3612f7aeff5263eca diff --git a/official/sunrise-sunset.groovy b/official/sunrise-sunset.groovy index 417cce6..783684a 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") { @@ -68,25 +68,29 @@ def updated() { } def initialize() { - subscribe(location, "position", locationPositionChange) + subscribe(location, "mode", 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