// 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){
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) {