Update vacation-lighting-director.groovy
[smartapps.git] / official / vacation-lighting-director.groovy
index c3187b743e3d94e36d5ded3652adf76c5749a6a5..7354edd853d8a3f9d003999e697c7a868ae44af3 100755 (executable)
@@ -37,11 +37,10 @@ definition(
 )
 
 preferences {
-    page name:"pageSetup"
-    page name:"Setup"
-    page name:"Settings"
     page name: "timeIntervalInput"
-
+    page name:"Settings1"
+    page name:"Setup"
+    page name:"pageSetup"
 }
 
 // Show setup page
@@ -62,7 +61,7 @@ def pageSetup() {
         }
         section("Setup Menu") {
             href "Setup", title: "Setup", description: "", state:greyedOut()
-            href "Settings", title: "Settings", description: "", state: greyedOutSettings()
+            href "Settings1", title: "Settings1", description: "", state: greyedOutSettings()
             }
         section([title:"Options", mobileOnly:true]) {
             label title:"Assign a name", required:false
@@ -134,7 +133,7 @@ def Setup() {
 }
 
 // Show "Setup" page
-def Settings() {
+def Settings1() {
 
     def falseAlarmThreshold = [
         name:       "falseAlarmThreshold",
@@ -151,11 +150,11 @@ def Settings() {
         options: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
     ]
     
-    def pageName = "Settings"
+    def pageName = "Settings1"
     
     def pageProperties = [
-        name:       "Settings",
-        title:      "Settings",
+        name:       "Settings1",
+        title:      "Settings1",
         nextPage:   "pageSetup"
     ]
     
@@ -246,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){
@@ -262,7 +262,7 @@ def scheduleCheck(evt) {
         }
         
         // 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) {
@@ -292,7 +292,7 @@ def scheduleCheck(evt) {
 
 //below is used to check restrictions
 private getAllOk() {
-       modeOk && daysOk && timeOk && homeIsEmpty
+       modeOk && homeIsEmpty/*&& daysOk && timeOk*/
 }