Update Switches.groovy
authorRahmadi Trimananda <rahmadi.trimananda@uci.edu>
Fri, 9 Aug 2019 17:36:37 +0000 (10:36 -0700)
committerGitHub Enterprise <noreply@github.uci.edu>
Fri, 9 Aug 2019 17:36:37 +0000 (10:36 -0700)
third-party/Switches.groovy

index ba2d817e3432d4c7481da99bd4b909bd55496a53..9629299765561421ead1ae0662fcd52a01433979 100755 (executable)
@@ -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)
   }
 }