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")
35 subscribe(switches, "switch", switchHandler)
38 def switchHandler(evt) {
39 def s = switches.find{ evt.deviceId == it.id }
40 def phrase = location.helloHome.getPhrases().find { it.label == s.displayName }
42 location.helloHome.execute(phrase.label)
44 def mode = location.modes.find { it.name == s.displayName }
51 page(name: selectSwitches)
54 def selectSwitches() {
55 dynamicPage(name: "selectSwitches", title: "Switches", install: true) {
56 section("Select switches named after Hello Home phrases") {
57 input "switches", "capability.switch", title: "Switches", multiple: true