1 // This function runs when the SmartApp is installed
3 // This is a standard debug statement in Groovy
4 log.debug "Installed with settings: ${settings}"
8 // This function runs when the SmartApp has been updated
10 log.debug "Updated with settings: ${settings}"
11 // Notice that all event subscriptions are removed when a SmartApp is updated
16 // This function is where you initialize callbacks for event listeners
18 // The subscribe function takes a input, a state, and a callback method
19 subscribe(contact, "contact.open", openHandler)
20 subscribe(contact, "contact.closed", closedHandler)
23 // These are our callback methods
24 def openHandler(evt) {
25 log.debug "$evt.name: $evt.value"
30 def closedHandler(evt) {
31 log.debug "$evt.name: $evt.value"
32 // Turn the light off and lock the lock