2 * Copyright 2015 Jesse Newland
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 * in compliance with the License. You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
10 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
11 * for the specific language governing permissions and limitations under the License.
15 name: "Hello Home / Mode Switches",
16 namespace: "jnewland",
17 author: "Jesse Newland",
18 description: "Name on/off tiles the same as your Hello Home phrases or Modes",
19 category: "SmartThings Labs",
20 iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
21 iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
22 iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png")
25 page(name: "selectSwitches")
28 def selectSwitches() {
29 dynamicPage(name: "selectSwitches", title: "Switches", install: true) {
30 section("Select switches named after Hello Home phrases") {
31 input "switches", "capability.switch", title: "Switches", multiple: true
33 section("Change to this mode") {
34 input "newMode", "mode", title: "Mode?"
49 subscribe(switches, "switch", switchHandler)
52 def switchHandler(evt) {
53 def s = switches.find{ evt.deviceId == it.id }
54 //def phrase = location.helloHome.getPhrases().find { it.label == s.displayName }
57 location.helloHome.execute(phrase.label)
59 // This looks like a bug because device's displayName has nothing to do with modes
60 //def mode = location.modes.find { it.name == s.displayName }
62 setLocationMode(newMode)