X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=third-party%2FSwitches.groovy;h=52549f2b284629208ae4f7aad8e6b4eca1189c59;hb=b51a1ebcdd2aad93864d307c21decb690d5ed645;hp=3a2286815b7edc078cefce38082a4c13547fd187;hpb=1b4858c31e2d38ddfaadb872f0acb11df0887990;p=smartapps.git diff --git a/third-party/Switches.groovy b/third-party/Switches.groovy index 3a22868..52549f2 100755 --- a/third-party/Switches.groovy +++ b/third-party/Switches.groovy @@ -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?" + } } } @@ -48,12 +51,14 @@ def initialize() { def switchHandler(evt) { def s = switches.find{ evt.deviceId == it.id } - def phrase = location.helloHome.getPhrases().find { it.label == s.displayName } + //def phrase = location.helloHome.getPhrases().find { it.label == s.displayName } + def phrase 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) } }