Update auto-humidity-vent.groovy
[smartapps.git] / official / Contact_Activated_Lighting.groovy
1 /**
2  *  Contact Activated Lighting
3  *
4  *  Copyright 2016 Tim Slagle
5  *
6  *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
7  *  in compliance with the License. You may obtain a copy of the License at:
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
12  *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
13  *  for the specific language governing permissions and limitations under the License.
14  *
15  */
16 definition(
17     name: "Contact Activated Lighting",
18     namespace: "tslagle13",
19     author: "Tim Slagle",
20     description: "Create child apps that will use a contact sensor to turn on lights.",
21     category: "Convenience",
22     iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
23     iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
24     iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png")
25
26
27 preferences {
28     page(name: "mainPage", title: "Child Apps", install: true, uninstall: true) {
29         section {
30             app(name: "childRule", appName: "Light Rule", namespace: "tslagle13", title: "New Lighting Rule", multiple: true)
31         }
32     }
33 }
34
35 def installed() {
36         log.debug "Installed with settings: ${settings}"
37
38         initialize()
39 }
40
41 def updated() {
42         log.debug "Updated with settings: ${settings}"
43
44         unsubscribe()
45         initialize()
46 }
47
48 def initialize() {
49         // TODO: subscribe to attributes, devices, locations, etc.
50 }