From: Seyed Amir Hossein Aqajari Date: Mon, 5 Aug 2019 01:48:50 +0000 (-0700) Subject: Update loft.groovy X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=bb6f6515ec1f4b2d17283970a9b2562b43a28bb1;p=smartapps.git Update loft.groovy --- diff --git a/third-party/loft.groovy b/third-party/loft.groovy index 4e41ab9..7b1368e 100755 --- a/third-party/loft.groovy +++ b/third-party/loft.groovy @@ -58,16 +58,16 @@ def updated() { } 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()