Changing remote branch to PLRG Git server.
[smartapps.git] / third-party / Zwave-indicator-manager.groovy
1 // Automatically generated. Make future change here.
2 definition(
3     name: "Zwave Switch Indicator Light Manager",
4     namespace: "sticks18",
5     author: "Scott Gibson",
6     description: "Changes the indicator light setting to always be off",
7     category: "My Apps",
8     iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
9     iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience%402x.png"
10 )
11
12 preferences {
13         section("When these switches are toggled adjust the indicator...") { 
14                 input "mains", "capability.switch", 
15                         multiple: true, 
16                         title: "Switches to fix...", 
17                         required: false
18         }
19     
20     section("When these switches are toggled adjust the indicator in reverse (useful for Linear brand)...") { 
21                 input "mains2", "capability.switch", 
22                         multiple: true, 
23                         title: "Switches to fix in reverse...", 
24                         required: false
25         }
26
27 }
28
29 def installed()
30 {
31         subscribe(mains, "switch.on", switchOnHandler)
32         subscribe(mains, "switch.off", switchOffHandler)
33         subscribe(mains2, "switch.on", switchOnHandler2)
34         subscribe(mains2, "switch.off", switchOffHandler2)
35 }
36
37 def updated()
38 {
39         unsubscribe()
40         subscribe(mains, "switch.on", switchOnHandler)
41         subscribe(mains, "switch.off", switchOffHandler)
42         subscribe(mains2, "switch.on", switchOnHandler2)
43         subscribe(mains2, "switch.off", switchOffHandler2)
44         log.info "subscribed to all of switches events"
45 }
46
47 def switchOffHandler(evt) {
48         log.info "switchoffHandler Event: ${evt.value}"
49         mains?.indicatorWhenOn()
50 }
51
52 def switchOnHandler(evt) {
53         log.info "switchOnHandler Event: ${evt.value}"
54         mains?.indicatorWhenOff()
55 }
56
57 def switchOffHandler2(evt) {
58         log.info "switchoffHandler2 Event: ${evt.value}"
59         mains2?.indicatorWhenOff()
60 }
61
62 def switchOnHandler2(evt) {
63         log.info "switchOnHandler2 Event: ${evt.value}"
64         mains2?.indicatorWhenOn()
65 }