From: Seyed Amir Hossein Aqajari Date: Sun, 11 Aug 2019 00:06:44 +0000 (-0700) Subject: Update vacation-lighting-director.groovy X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=73703836ed59e7974b1d2fc1cdf83627aae600de;p=smartapps.git Update vacation-lighting-director.groovy --- diff --git a/official/vacation-lighting-director.groovy b/official/vacation-lighting-director.groovy index feab821..7354edd 100755 --- a/official/vacation-lighting-director.groovy +++ b/official/vacation-lighting-director.groovy @@ -245,7 +245,8 @@ def scheduleCheck(evt) { // grab a random switch def random = new Random() - def inactive_switches = switches + def inactive_switches = [] + inactive_switches.add(switches) for (int i = 0 ; i < number_of_active_lights ; i++) { // if there are no inactive switches to turn on then let's break if (inactive_switches.size() == 0){ @@ -257,11 +258,11 @@ def scheduleCheck(evt) { inactive_switches[random_int].on() // then remove that switch from the pool off switches that can be turned on - //inactive_switches.remove(random_int) + inactive_switches.remove(random_int) } // re-run again when the frequency demands it - schedule("0 0/${frequency_minutes} * 1/1 * ? *", scheduleCheck) + //schedule("0 0/${frequency_minutes} * 1/1 * ? *", scheduleCheck) } //Check to see if mode is ok but not time/day. If mode is still ok, check again after frequency period. else if (modeOk) {