From 73703836ed59e7974b1d2fc1cdf83627aae600de Mon Sep 17 00:00:00 2001 From: Seyed Amir Hossein Aqajari Date: Sat, 10 Aug 2019 17:06:44 -0700 Subject: [PATCH] Update vacation-lighting-director.groovy --- official/vacation-lighting-director.groovy | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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) { -- 2.34.1