Update once-a-day.groovy
[smartapps.git] / official / smart-nightlight.groovy
index 53bc14cb3988348be29c10f65bff8d25821d3df8..af86f9d539c83470d416b1600763d141f447bf24 100755 (executable)
@@ -47,7 +47,7 @@ preferences {
                input "sunsetOffsetDir", "enum", title: "Before or After", required: false, options: ["Before","After"]
        }
        section ("Zip code (optional, defaults to location coordinates when location services are enabled)...") {
-               input "zipCode", "text", title: "Zip code", required: false
+               input "zipCode1", "text", title: "Zip code", required: false
        }
 }
 
@@ -67,7 +67,7 @@ def initialize() {
                subscribe(lightSensor, "illuminance", illuminanceHandler, [filterEvents: false])
        }
        else {
-               subscribe(location, "position", locationPositionChange)
+               subscribe(location, "mode", locationPositionChange)
                subscribe(location, "sunriseTime", sunriseSunsetTimeHandler)
                subscribe(location, "sunsetTime", sunriseSunsetTimeHandler)
                //astroCheck()
@@ -146,7 +146,7 @@ def scheduleCheck() {
 }
 
 def astroCheck() {
-       def s = getSunriseAndSunset(zipCode: zipCode, sunriseOffset: sunriseOffset, sunsetOffset: sunsetOffset)
+       def s = getSunriseAndSunset(zipCode: zipCode1, sunriseOffset: sunriseOffset, sunsetOffset: sunsetOffset)
        state.riseTime = s.sunrise.time
        state.setTime = s.sunset.time
        log.debug "rise: ${new Date(state.riseTime)}($state.riseTime), set: ${new Date(state.setTime)}($state.setTime)"