Update vacation-lighting-director.groovy
authorSeyed Amir Hossein Aqajari <amiraj.95@uci.edu>
Sun, 11 Aug 2019 00:06:44 +0000 (17:06 -0700)
committerGitHub Enterprise <noreply@github.uci.edu>
Sun, 11 Aug 2019 00:06:44 +0000 (17:06 -0700)
official/vacation-lighting-director.groovy

index feab8212eadbe0f1131a788a2dceee3cbf6c1fc5..7354edd853d8a3f9d003999e697c7a868ae44af3 100755 (executable)
@@ -245,7 +245,8 @@ def scheduleCheck(evt) {
         
         // grab a random switch
         def random = new Random()
         
         // 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){
         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[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
         }
         
         // 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) {
     }
     //Check to see if mode is ok but not time/day.  If mode is still ok, check again after frequency period.
     else if (modeOk) {