1212 *
1313 */
1414metadata {
15- definition (name : " Z-Wave Switch Generic" , namespace : " smartthings" , author : " SmartThings" , ocfDeviceType : " oic.d.switch" , runLocally : true , minHubCoreVersion : ' 000.019.00012' , executeCommandsLocally : true ) {
15+ definition(name : " Z-Wave Switch Generic" , namespace : " smartthings" , author : " SmartThings" , ocfDeviceType : " oic.d.switch" , runLocally : true , minHubCoreVersion : ' 000.019.00012' , executeCommandsLocally : true ) {
1616 capability " Actuator"
1717 capability " Health Check"
18- capability " Switch"
18+ capability " Switch"
1919 capability " Polling"
2020 capability " Refresh"
2121 capability " Sensor"
2222 capability " Light"
2323
2424 fingerprint inClusters : " 0x25" , deviceJoinName : " Z-Wave Switch"
25- fingerprint mfr :" 001D" , prod :" 1A02" , model :" 0334" , deviceJoinName : " Leviton Appliance Module"
26- fingerprint mfr :" 0063" , prod :" 4F50" , model :" 3031" , deviceJoinName : " GE Plug-in Outdoor Switch"
27- fingerprint mfr :" 001D" , prod :" 1D04" , model :" 0334" , deviceJoinName : " Leviton Outlet"
28- fingerprint mfr :" 001D" , prod :" 1C02" , model :" 0334" , deviceJoinName : " Leviton Switch"
29- fingerprint mfr :" 001D" , prod :" 0301" , model :" 0334" , deviceJoinName : " Leviton 15A Switch"
30- fingerprint mfr :" 001D" , prod :" 0F01" , model :" 0334" , deviceJoinName : " Leviton 5A Incandescent Switch"
31- fingerprint mfr :" 001D" , prod :" 1603" , model :" 0334" , deviceJoinName : " Leviton 15A Split Duplex Receptacle"
32- fingerprint mfr :" 011A" , prod :" 0101" , model :" 0102" , deviceJoinName : " Enerwave On/Off Switch"
33- fingerprint mfr :" 011A" , prod :" 0101" , model :" 0603" , deviceJoinName : " Enerwave Duplex Receptacle"
34- fingerprint mfr :" 0039" , prod :" 5052" , model :" 3038" , deviceJoinName : " Honeywell Z-Wave Plug-in Switch"
35- fingerprint mfr :" 0039" , prod :" 5052" , model :" 3033" , deviceJoinName : " Honeywell Z-Wave Plug-in Switch (Dual Outlet)"
36- fingerprint mfr :" 0039" , prod :" 4F50" , model :" 3032" , deviceJoinName : " Honeywell Z-Wave Plug-in Outdoor Smart Switch"
37- fingerprint mfr :" 0039" , prod :" 4952" , model :" 3036" , deviceJoinName : " Honeywell Z-Wave In-Wall Smart Switch"
38- fingerprint mfr :" 0039" , prod :" 4952" , model :" 3037" , deviceJoinName : " Honeywell Z-Wave In-Wall Smart Toggle Switch"
39- fingerprint mfr :" 0039" , prod :" 4952" , model :" 3133" , deviceJoinName : " Honeywell Z-Wave In-Wall Tamper Resistant Duplex Receptacle"
25+ fingerprint mfr : " 001D" , prod : " 1A02" , model : " 0334" , deviceJoinName : " Leviton Appliance Module"
26+ fingerprint mfr : " 0063" , prod : " 4F50" , model : " 3031" , deviceJoinName : " GE Plug-in Outdoor Switch"
27+ fingerprint mfr : " 001D" , prod : " 1D04" , model : " 0334" , deviceJoinName : " Leviton Outlet"
28+ fingerprint mfr : " 001D" , prod : " 1C02" , model : " 0334" , deviceJoinName : " Leviton Switch"
29+ fingerprint mfr : " 001D" , prod : " 0301" , model : " 0334" , deviceJoinName : " Leviton 15A Switch"
30+ fingerprint mfr : " 001D" , prod : " 0F01" , model : " 0334" , deviceJoinName : " Leviton 5A Incandescent Switch"
31+ fingerprint mfr : " 001D" , prod : " 1603" , model : " 0334" , deviceJoinName : " Leviton 15A Split Duplex Receptacle"
32+ fingerprint mfr : " 011A" , prod : " 0101" , model : " 0102" , deviceJoinName : " Enerwave On/Off Switch"
33+ fingerprint mfr : " 011A" , prod : " 0101" , model : " 0603" , deviceJoinName : " Enerwave Duplex Receptacle"
34+ fingerprint mfr : " 0039" , prod : " 5052" , model : " 3038" , deviceJoinName : " Honeywell Z-Wave Plug-in Switch"
35+ fingerprint mfr : " 0039" , prod : " 5052" , model : " 3033" , deviceJoinName : " Honeywell Z-Wave Plug-in Switch (Dual Outlet)"
36+ fingerprint mfr : " 0039" , prod : " 4F50" , model : " 3032" , deviceJoinName : " Honeywell Z-Wave Plug-in Outdoor Smart Switch"
37+ fingerprint mfr : " 0039" , prod : " 4952" , model : " 3036" , deviceJoinName : " Honeywell Z-Wave In-Wall Smart Switch"
38+ fingerprint mfr : " 0039" , prod : " 4952" , model : " 3037" , deviceJoinName : " Honeywell Z-Wave In-Wall Smart Toggle Switch"
39+ fingerprint mfr : " 0039" , prod : " 4952" , model : " 3133" , deviceJoinName : " Honeywell Z-Wave In-Wall Tamper Resistant Duplex Receptacle"
40+ fingerprint mfr : " 001A" , prod : " 5244" , deviceJoinName : " Eaton RF Receptacle"
41+ fingerprint mfr : " 001A" , prod : " 534C" , model : " 0000" , deviceJoinName : " Eaton RF Master Switch"
42+ fingerprint mfr : " 001A" , prod : " 5354" , model : " 0003" , deviceJoinName : " Eaton RF Appliance Plug-In Module"
4043 }
4144
4245 // simulator metadata
4346 simulator {
44- status " on" : " command: 2003, payload: FF"
47+ status " on" : " command: 2003, payload: FF"
4548 status " off" : " command: 2003, payload: 00"
4649
4750 // reply messages
@@ -51,29 +54,29 @@ metadata {
5154
5255 // tile definitions
5356 tiles(scale : 2 ) {
54- multiAttributeTile(name :" switch" , type : " lighting" , width : 6 , height : 4 , canChangeIcon : true ){
55- tileAttribute (" device.switch" , key : " PRIMARY_CONTROL" ) {
57+ multiAttributeTile(name : " switch" , type : " lighting" , width : 6 , height : 4 , canChangeIcon : true ) {
58+ tileAttribute(" device.switch" , key : " PRIMARY_CONTROL" ) {
5659 attributeState " on" , label : ' ${name}' , action : " switch.off" , icon : " st.switches.switch.on" , backgroundColor : " #00A0DC"
5760 attributeState " off" , label : ' ${name}' , action : " switch.on" , icon : " st.switches.switch.off" , backgroundColor : " #ffffff"
5861 }
5962 }
6063
6164 standardTile(" refresh" , " device.switch" , width : 2 , height : 2 , inactiveLabel : false , decoration : " flat" ) {
62- state " default" , label :' ' , action :" refresh.refresh" , icon :" st.secondary.refresh"
65+ state " default" , label : ' ' , action : " refresh.refresh" , icon : " st.secondary.refresh"
6366 }
6467
6568 main " switch"
66- details([" switch" ," refresh" ])
69+ details([" switch" , " refresh" ])
6770 }
6871}
6972
70- def installed (){
73+ def installed () {
7174// Device-Watch simply pings if no device events received for checkInterval duration of 32min = 2 * 15min + 2min lag time
7275 sendEvent(name : " checkInterval" , value : 2 * 15 * 60 + 2 * 60 , displayed : false , data : [protocol : " zwave" , hubHardwareId : device. hub. hardwareID, offlinePingable : " 1" ])
7376 response(refresh())
7477}
7578
76- def updated (){
79+ def updated () {
7780// Device-Watch simply pings if no device events received for checkInterval duration of 32min = 2 * 15min + 2min lag time
7881 sendEvent(name : " checkInterval" , value : 2 * 15 * 60 + 2 * 60 , displayed : false , data : [protocol : " zwave" , hubHardwareId : device. hub. hardwareID, offlinePingable : " 1" ])
7982}
@@ -113,22 +116,15 @@ def zwaveEvent(physicalgraph.zwave.commands.switchbinaryv1.SwitchBinaryReport cm
113116 [name : " switch" , value : cmd. value ? " on" : " off" , type: " digital" ]
114117}
115118
116- def zwaveEvent (physicalgraph.zwave.commands.configurationv1.ConfigurationReport cmd ) {
117- def value = " when off"
118- if (cmd. configurationValue[0 ] == 1 ) {value = " when on" }
119- if (cmd. configurationValue[0 ] == 2 ) {value = " never" }
120- [name : " indicatorStatus" , value : value, display : false ]
121- }
122-
123119def zwaveEvent (physicalgraph.zwave.commands.hailv1.Hail cmd ) {
124120 [name : " hail" , value : " hail" , descriptionText : " Switch button was pressed" , displayed : false ]
125121}
126122
127123def zwaveEvent (physicalgraph.zwave.commands.manufacturerspecificv2.ManufacturerSpecificReport cmd ) {
128- log. debug " manufacturerId: ${ cmd.manufacturerId} "
129- log. debug " manufacturerName: ${ cmd.manufacturerName} "
130- log. debug " productId: ${ cmd.productId} "
131- log. debug " productTypeId: ${ cmd.productTypeId} "
124+ log. debug " manufacturerId: $cmd . manufacturerId "
125+ log. debug " manufacturerName: $cmd . manufacturerName "
126+ log. debug " productId: $cmd . productId "
127+ log. debug " productTypeId: $cmd . productTypeId "
132128 def msr = String . format(" %04X-%04X-%04X" , cmd. manufacturerId, cmd. productTypeId, cmd. productId)
133129 updateDataValue(" MSR" , msr)
134130 updateDataValue(" manufacturer" , cmd. manufacturerName)
@@ -165,10 +161,7 @@ def off() {
165161}
166162
167163def poll () {
168- delayBetween([
169- zwave. switchBinaryV1. switchBinaryGet(). format(),
170- zwave. manufacturerSpecificV1. manufacturerSpecificGet(). format()
171- ])
164+ refresh()
172165}
173166
174167/**
@@ -179,17 +172,10 @@ def ping() {
179172}
180173
181174def refresh () {
182- delayBetween([
183- zwave. switchBinaryV1. switchBinaryGet(). format(),
184- zwave. manufacturerSpecificV1. manufacturerSpecificGet(). format()
185- ])
186- }
187-
188- def invertSwitch (invert = true ) {
189- if (invert) {
190- zwave. configurationV1. configurationSet(configurationValue : [1 ], parameterNumber : 4 , size : 1 ). format()
191- }
192- else {
193- zwave. configurationV1. configurationSet(configurationValue : [0 ], parameterNumber : 4 , size : 1 ). format()
175+ def commands = []
176+ commands << zwave. switchBinaryV1. switchBinaryGet(). format()
177+ if (getDataValue(" MSR" ) == null ) {
178+ commands << zwave. manufacturerSpecificV1. manufacturerSpecificGet(). format()
194179 }
180+ delayBetween(commands)
195181}
0 commit comments