From: Rahmadi Trimananda Date: Fri, 9 Aug 2019 17:36:37 +0000 (-0700) Subject: Update Switches.groovy X-Git-Url: http://plrg.eecs.uci.edu/git/?p=smartapps.git;a=commitdiff_plain;h=66814dc59f1e3a67930000b5f910c89727ef8852 Update Switches.groovy --- diff --git a/third-party/Switches.groovy b/third-party/Switches.groovy index ba2d817..9629299 100755 --- a/third-party/Switches.groovy +++ b/third-party/Switches.groovy @@ -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) } }