}
def initialize() {
- subscribe(monitor_switches, "switch", eventHandler)
- subscribe(monitor_motion, "motion", eventHandler)
- subscribe(monitor_presence, "presence", eventHandler)
- subscribe(location, "mode", eventHandler)
- subscribe(location, "sunset", eventHandler)
- subscribe(location, "sunrise", eventHandler)
+ subscribe(monitor_switches, "switch", eventHandler1)
+ subscribe(monitor_motion, "motion", eventHandler1)
+ subscribe(monitor_presence, "presence", eventHandler1)
+ subscribe(location, "mode", eventHandler1)
+ subscribe(location, "sunset", eventHandler1)
+ subscribe(location, "sunrise", eventHandler1)
tick()
}
-def eventHandler(evt) {
+def eventHandler1(evt) {
def everyone_here = presense_is_after(monitor_presence, "present", 10)
def everyone_gone = presense_is_after(monitor_presence, "not present", 10)
def current_count = monitor_presence.findAll { it.currentPresence == "present" }.size()
def changeMode(mode) {
//voice?.speak("changing mode to ${mode}")
setLocationMode(mode)
- eventHandler([
+ eventHandler1([
displayName: "changeMode",
value: mode
])
}
def tick() {
- eventHandler([
+ eventHandler1([
displayName: "tick",
value: "tock"
])
private is_daytime() {
- def data = getWeatherFeature("astronomy")
+ return true
+ /*def data = getWeatherFeature("astronomy")
def sunset = "${data.moon_phase.sunset.hour}${data.moon_phase.sunset.minute}"
def sunrise = "${data.moon_phase.sunrise.hour}${data.moon_phase.sunrise.minute}"
def current = "${data.moon_phase.current_time.hour}${data.moon_phase.current_time.minute}"
}
else {
return false
- }
+ }*/
}
private presense_is_after(people, presence, minutes) {