}
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()