Update laundry-monitor.groovy
[smartapps.git] / third-party / Switches.groovy
index 3a2286815b7edc078cefce38082a4c13547fd187..9629299765561421ead1ae0662fcd52a01433979 100755 (executable)
@@ -22,7 +22,7 @@ definition(
     iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png")
 
 preferences {
-  page(name: selectSwitches)
+  page(name: "selectSwitches")
 }
 
 def selectSwitches() {
@@ -30,6 +30,9 @@ def selectSwitches() {
         section("Select switches named after Hello Home phrases") {
             input "switches", "capability.switch", title: "Switches", multiple: true
         }
+        section("Change to this mode") {
+                   input "newMode", "mode", title: "Mode?"
+           }
     }
 }
 
@@ -52,8 +55,9 @@ def switchHandler(evt) {
   if (phrase) {
     location.helloHome.execute(phrase.label)
   }
-  def mode = location.modes.find { it.name == s.displayName }
-  if (mode) {
-    setLocationMode(mode)
+  // This looks like a bug because device's displayName has nothing to do with modes
+  //def mode = location.modes.find { it.name == s.displayName }
+  if (newMode) {
+    setLocationMode(newMode)
   }
 }