2 * Copyright 2015 SmartThings
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.
14 * Turn your lights on when an open/close sensor opens and off when the sensor closes.
19 name: "Let There Be Light!",
20 namespace: "smartthings",
21 author: "SmartThings",
22 description: "Turn your lights on when a SmartSense Multi is opened and turn them off when it is closed.",
23 category: "Convenience",
24 iconUrl: "https://s3.amazonaws.com/smartapp-icons/Meta/light_contact-outlet.png",
25 iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Meta/light_contact-outlet@2x.png"
29 section("When the door opens/closes...") {
30 input "contact1", "capability.contactSensor", title: "Where?"
32 section("Turn on/off a light...") {
33 input "switch1", "capability.switch"
38 subscribe(contact1, "contact", contactHandler)
43 subscribe(contact1, "contact", contactHandler)
46 def contactHandler(evt) {
47 log.debug "$evt.value"
48 if (evt.value == "open") {
50 } else if (evt.value == "closed") {