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
}
}
subscribe(location, "position", locationPositionChange)
subscribe(location, "sunriseTime", sunriseSunsetTimeHandler)
subscribe(location, "sunsetTime", sunriseSunsetTimeHandler)
- astroCheck()
+ //astroCheck()
}
}
def locationPositionChange(evt) {
log.trace "locationChange()"
- astroCheck()
+ //astroCheck()
}
def sunriseSunsetTimeHandler(evt) {
state.lastSunriseSunsetEvent = now()
log.debug "SmartNightlight.sunriseSunsetTimeHandler($app.id)"
- astroCheck()
+ //astroCheck()
}
def motionHandler(evt) {
}
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)"