Update Switches.groovy
[smartapps.git] / official / sunrise-sunset.groovy
index 3e4fd1f60a1f1068b9c4a62ccae8ee4960f92d08..783684a58786b530e30740665e21a2399acad0f2 100755 (executable)
@@ -68,21 +68,25 @@ 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() {