1212 *
1313 */
1414metadata {
15- definition (name : " Z-Wave Dimmer Switch Generic" , namespace : " smartthings" , author : " SmartThings" , ocfDeviceType : " oic.d.light" , runLocally : true , minHubCoreVersion : ' 000.019.00012' , executeCommandsLocally : true ) {
15+ definition(name : " Z-Wave Dimmer Switch Generic" , namespace : " smartthings" , author : " SmartThings" , ocfDeviceType : " oic.d.light" , runLocally : true , minHubCoreVersion : ' 000.019.00012' , executeCommandsLocally : true ) {
1616 capability " Switch Level"
1717 capability " Actuator"
1818 capability " Health Check"
@@ -23,26 +23,28 @@ metadata {
2323 capability " Light"
2424
2525 fingerprint inClusters : " 0x26" , deviceJoinName : " Z-Wave Dimmer"
26- fingerprint mfr :" 001D" , prod :" 1902" , deviceJoinName : " Z-Wave Dimmer"
27- fingerprint mfr :" 001D" , prod :" 1B03" , model :" 0334" , deviceJoinName : " Leviton Universal Dimmer"
28- fingerprint mfr :" 011A" , prod :" 0102" , model :" 0201" , deviceJoinName : " Enerwave In-Wall Dimmer"
29- fingerprint mfr :" 001D" , prod :" 1001" , model :" 0334" , deviceJoinName : " Leviton 3-Speed Fan Controller"
30- fingerprint mfr :" 001D" , prod :" 0602" , model :" 0334" , deviceJoinName : " Leviton Magnetic Low Voltage Dimmer"
31- fingerprint mfr :" 001D" , prod :" 0401" , model :" 0334" , deviceJoinName : " Leviton 600W Incandescent Dimmer"
32- fingerprint mfr :" 0111" , prod :" 8200" , model :" 0200" , deviceJoinName : " Remotec Technology Plug-In Dimmer"
33- fingerprint mfr :" 1104" , prod :" 001D" , model :" 0501" , deviceJoinName : " Leviton 1000W Incandescant Dimmer"
34- fingerprint mfr :" 0039" , prod :" 5044" , model :" 3033" , deviceJoinName : " Honeywell Z-Wave Plug-in Dimmer (Dual Outlet)"
35- fingerprint mfr :" 0039" , prod :" 5044" , model :" 3038" , deviceJoinName : " Honeywell Z-Wave Plug-in Dimmer"
36- fingerprint mfr :" 0039" , prod :" 4944" , model :" 3038" , deviceJoinName : " Honeywell Z-Wave In-Wall Smart Dimmer"
37- fingerprint mfr :" 0039" , prod :" 4944" , model :" 3130" , deviceJoinName : " Honeywell Z-Wave In-Wall Smart Toggle Dimmer"
38- fingerprint mfr :" 0063" , prod :" 4944" , model :" 3034" , deviceJoinName : " GE In-Wall Smart Fan Control"
39- fingerprint mfr :" 0063" , prod :" 4944" , model :" 3131" , deviceJoinName : " GE In-Wall Smart Fan Control"
40- fingerprint mfr :" 0039" , prod :" 4944" , model :" 3131" , deviceJoinName : " Honeywell Z-Wave Plus In-Wall Fan Speed Control"
41- fingerprint mfr :" 0086" , prod :" 0103" , model :" 0063" , deviceJoinName : " Aeotec Smart Dimmer 6"
26+ fingerprint mfr : " 001D" , prod : " 1902" , deviceJoinName : " Z-Wave Dimmer"
27+ fingerprint mfr : " 001D" , prod : " 1B03" , model : " 0334" , deviceJoinName : " Leviton Universal Dimmer"
28+ fingerprint mfr : " 011A" , prod : " 0102" , model : " 0201" , deviceJoinName : " Enerwave In-Wall Dimmer"
29+ fingerprint mfr : " 001D" , prod : " 1001" , model : " 0334" , deviceJoinName : " Leviton 3-Speed Fan Controller"
30+ fingerprint mfr : " 001D" , prod : " 0602" , model : " 0334" , deviceJoinName : " Leviton Magnetic Low Voltage Dimmer"
31+ fingerprint mfr : " 001D" , prod : " 0401" , model : " 0334" , deviceJoinName : " Leviton 600W Incandescent Dimmer"
32+ fingerprint mfr : " 0111" , prod : " 8200" , model : " 0200" , deviceJoinName : " Remotec Technology Plug-In Dimmer"
33+ fingerprint mfr : " 1104" , prod : " 001D" , model : " 0501" , deviceJoinName : " Leviton 1000W Incandescant Dimmer"
34+ fingerprint mfr : " 0039" , prod : " 5044" , model : " 3033" , deviceJoinName : " Honeywell Z-Wave Plug-in Dimmer (Dual Outlet)"
35+ fingerprint mfr : " 0039" , prod : " 5044" , model : " 3038" , deviceJoinName : " Honeywell Z-Wave Plug-in Dimmer"
36+ fingerprint mfr : " 0039" , prod : " 4944" , model : " 3038" , deviceJoinName : " Honeywell Z-Wave In-Wall Smart Dimmer"
37+ fingerprint mfr : " 0039" , prod : " 4944" , model : " 3130" , deviceJoinName : " Honeywell Z-Wave In-Wall Smart Toggle Dimmer"
38+ fingerprint mfr : " 0063" , prod : " 4944" , model : " 3034" , deviceJoinName : " GE In-Wall Smart Fan Control"
39+ fingerprint mfr : " 0063" , prod : " 4944" , model : " 3131" , deviceJoinName : " GE In-Wall Smart Fan Control"
40+ fingerprint mfr : " 0039" , prod : " 4944" , model : " 3131" , deviceJoinName : " Honeywell Z-Wave Plus In-Wall Fan Speed Control"
41+ fingerprint mfr : " 001A" , prod : " 4449" , model : " 0101" , deviceJoinName : " Eaton RF Master Dimmer"
42+ fingerprint mfr : " 001A" , prod : " 4449" , model : " 0003" , deviceJoinName : " Eaton RF Dimming Plug-In Module"
43+ fingerprint mfr : " 0086" , prod : " 0103" , model : " 0063" , deviceJoinName : " Aeotec Smart Dimmer 6"
4244 }
4345
4446 simulator {
45- status " on" : " command: 2003, payload: FF"
47+ status " on" : " command: 2003, payload: FF"
4648 status " off" : " command: 2003, payload: 00"
4749 status " 09%" : " command: 2003, payload: 09"
4850 status " 10%" : " command: 2003, payload: 0A"
@@ -60,24 +62,24 @@ metadata {
6062 }
6163
6264 tiles(scale : 2 ) {
63- multiAttributeTile(name :" switch" , type : " lighting" , width : 6 , height : 4 , canChangeIcon : true ){
64- tileAttribute (" device.switch" , key : " PRIMARY_CONTROL" ) {
65- attributeState " on" , label :' ${name}' , action :" switch.off" , icon :" st.switches.switch.on" , backgroundColor :" #00a0dc" , nextState :" turningOff"
66- attributeState " off" , label :' ${name}' , action :" switch.on" , icon :" st.switches.switch.off" , backgroundColor :" #ffffff" , nextState :" turningOn"
67- attributeState " turningOn" , label :' ${name}' , action :" switch.off" , icon :" st.switches.switch.on" , backgroundColor :" #00a0dc" , nextState :" turningOff"
68- attributeState " turningOff" , label :' ${name}' , action :" switch.on" , icon :" st.switches.switch.off" , backgroundColor :" #ffffff" , nextState :" turningOn"
65+ multiAttributeTile(name : " switch" , type : " lighting" , width : 6 , height : 4 , canChangeIcon : true ) {
66+ tileAttribute(" device.switch" , key : " PRIMARY_CONTROL" ) {
67+ attributeState " on" , label : ' ${name}' , action : " switch.off" , icon : " st.switches.switch.on" , backgroundColor : " #00a0dc" , nextState : " turningOff"
68+ attributeState " off" , label : ' ${name}' , action : " switch.on" , icon : " st.switches.switch.off" , backgroundColor : " #ffffff" , nextState : " turningOn"
69+ attributeState " turningOn" , label : ' ${name}' , action : " switch.off" , icon : " st.switches.switch.on" , backgroundColor : " #00a0dc" , nextState : " turningOff"
70+ attributeState " turningOff" , label : ' ${name}' , action : " switch.on" , icon : " st.switches.switch.off" , backgroundColor : " #ffffff" , nextState : " turningOn"
6971 }
70- tileAttribute (" device.level" , key : " SLIDER_CONTROL" ) {
71- attributeState " level" , action :" switch level.setLevel"
72+ tileAttribute(" device.level" , key : " SLIDER_CONTROL" ) {
73+ attributeState " level" , action : " switch level.setLevel"
7274 }
7375 }
7476
7577 standardTile(" refresh" , " device.switch" , width : 2 , height : 2 , inactiveLabel : false , decoration : " flat" ) {
76- state " default" , label :' ' , action :" refresh.refresh" , icon :" st.secondary.refresh"
78+ state " default" , label : ' ' , action : " refresh.refresh" , icon : " st.secondary.refresh"
7779 }
7880
7981 valueTile(" level" , " device.level" , inactiveLabel : false , decoration : " flat" , width : 2 , height : 2 ) {
80- state " level" , label :' ${currentValue} %' , unit :" %" , backgroundColor :" #ffffff"
82+ state " level" , label : ' ${currentValue} %' , unit : " %" , backgroundColor : " #ffffff"
8183 }
8284
8385 main([" switch" ])
@@ -86,13 +88,19 @@ metadata {
8688 }
8789}
8890
89- def installed (){
91+ def installed () {
9092// Device-Watch simply pings if no device events received for 32min(checkInterval)
9193 sendEvent(name : " checkInterval" , value : 2 * 15 * 60 + 2 * 60 , displayed : false , data : [protocol : " zwave" , hubHardwareId : device. hub. hardwareID, offlinePingable : " 1" ])
92- response(refresh())
94+ def commands = refresh()
95+ if (zwaveInfo. mfr. equals(" 001A" )) {
96+ commands << " delay 100"
97+ // for Eaton dimmers parameter 7 is ramp time. We set it to 1s for devices to work correctly with local execution
98+ commands << zwave. configurationV1. configurationSet(configurationValue : [1 ], parameterNumber : 7 , size : 1 ). format()
99+ }
100+ response(commands)
93101}
94102
95- def updated (){
103+ def updated () {
96104// Device-Watch simply pings if no device events received for 32min(checkInterval)
97105 sendEvent(name : " checkInterval" , value : 2 * 15 * 60 + 2 * 60 , displayed : false , data : [protocol : " zwave" , hubHardwareId : device. hub. hardwareID, offlinePingable : " 1" ])
98106}
@@ -102,7 +110,6 @@ def getCommandClassVersions() {
102110 0x20 : 1 , // Basic
103111 0x26 : 1 , // SwitchMultilevel
104112 0x56 : 1 , // Crc16Encap
105- 0x70 : 1 , // Configuration
106113 ]
107114}
108115
@@ -149,32 +156,23 @@ private dimmerEvents(physicalgraph.zwave.Command cmd) {
149156 return result
150157}
151158
152-
153- def zwaveEvent (physicalgraph.zwave.commands.configurationv1.ConfigurationReport cmd ) {
154- log. debug " ConfigurationReport $cmd "
155- def value = " when off"
156- if (cmd. configurationValue[0 ] == 1 ) {value = " when on" }
157- if (cmd. configurationValue[0 ] == 2 ) {value = " never" }
158- createEvent([name : " indicatorStatus" , value : value])
159- }
160-
161159def zwaveEvent (physicalgraph.zwave.commands.hailv1.Hail cmd ) {
162160 createEvent([name : " hail" , value : " hail" , descriptionText : " Switch button was pressed" , displayed : false ])
163161}
164162
165163def zwaveEvent (physicalgraph.zwave.commands.manufacturerspecificv2.ManufacturerSpecificReport cmd ) {
166- log. debug " manufacturerId: ${ cmd.manufacturerId} "
167- log. debug " manufacturerName: ${ cmd.manufacturerName} "
168- log. debug " productId: ${ cmd.productId} "
169- log. debug " productTypeId: ${ cmd.productTypeId} "
164+ log. debug " manufacturerId: $cmd . manufacturerId "
165+ log. debug " manufacturerName: $cmd . manufacturerName "
166+ log. debug " productId: $cmd . productId "
167+ log. debug " productTypeId: $cmd . productTypeId "
170168 def msr = String . format(" %04X-%04X-%04X" , cmd. manufacturerId, cmd. productTypeId, cmd. productId)
171169 updateDataValue(" MSR" , msr)
172170 updateDataValue(" manufacturer" , cmd. manufacturerName)
173171 createEvent([descriptionText : " $device . displayName MSR: $msr " , isStateChange : false ])
174172}
175173
176174def zwaveEvent (physicalgraph.zwave.commands.switchmultilevelv1.SwitchMultilevelStopLevelChange cmd ) {
177- [createEvent(name :" switch" , value :" on" ), response(zwave. switchMultilevelV1. switchMultilevelGet(). format())]
175+ [createEvent(name : " switch" , value : " on" ), response(zwave. switchMultilevelV1. switchMultilevelGet(). format())]
178176}
179177
180178def zwaveEvent (physicalgraph.zwave.commands.crc16encapv1.Crc16Encap cmd ) {
@@ -194,16 +192,16 @@ def zwaveEvent(physicalgraph.zwave.Command cmd) {
194192
195193def on () {
196194 delayBetween([
197- zwave. basicV1. basicSet(value : 0xFF ). format(),
198- zwave. switchMultilevelV1. switchMultilevelGet(). format()
199- ],5000 )
195+ zwave. basicV1. basicSet(value : 0xFF ). format(),
196+ zwave. switchMultilevelV1. switchMultilevelGet(). format()
197+ ], 5000 )
200198}
201199
202200def off () {
203201 delayBetween([
204- zwave. basicV1. basicSet(value : 0x00 ). format(),
205- zwave. switchMultilevelV1. switchMultilevelGet(). format()
206- ],5000 )
202+ zwave. basicV1. basicSet(value : 0x00 ). format(),
203+ zwave. switchMultilevelV1. switchMultilevelGet(). format()
204+ ], 5000 )
207205}
208206
209207def setLevel (value ) {
@@ -216,21 +214,21 @@ def setLevel(value) {
216214 sendEvent(name : " switch" , value : " off" )
217215 }
218216 sendEvent(name : " level" , value : level, unit : " %" )
219- delayBetween ([zwave. basicV1. basicSet(value : level). format(), zwave. switchMultilevelV1. switchMultilevelGet(). format()], 5000 )
217+ delayBetween([zwave. basicV1. basicSet(value : level). format(), zwave. switchMultilevelV1. switchMultilevelGet(). format()], 5000 )
220218}
221219
222220def setLevel (value , duration ) {
223221 log. debug " setLevel >> value: $value , duration: $duration "
224222 def valueaux = value as Integer
225223 def level = Math . max(Math . min(valueaux, 99 ), 0 )
226224 def dimmingDuration = duration < 128 ? duration : 128 + Math . round(duration / 60 )
227- def getStatusDelay = duration < 128 ? (duration* 1000 )+ 2000 : (Math . round(duration / 60 )* 60 * 1000 )+ 2000
228- delayBetween ([zwave. switchMultilevelV2. switchMultilevelSet(value : level, dimmingDuration : dimmingDuration). format(),
229- zwave. switchMultilevelV1. switchMultilevelGet(). format()], getStatusDelay)
225+ def getStatusDelay = duration < 128 ? (duration * 1000 ) + 2000 : (Math . round(duration / 60 ) * 60 * 1000 ) + 2000
226+ delayBetween([zwave. switchMultilevelV2. switchMultilevelSet(value : level, dimmingDuration : dimmingDuration). format(),
227+ zwave. switchMultilevelV1. switchMultilevelGet(). format()], getStatusDelay)
230228}
231229
232230def poll () {
233- zwave . switchMultilevelV1 . switchMultilevelGet() . format ()
231+ refresh ()
234232}
235233
236234/**
@@ -247,14 +245,5 @@ def refresh() {
247245 if (getDataValue(" MSR" ) == null ) {
248246 commands << zwave. manufacturerSpecificV1. manufacturerSpecificGet(). format()
249247 }
250- delayBetween(commands,100 )
251- }
252-
253- def invertSwitch (invert = true ) {
254- if (invert) {
255- zwave. configurationV1. configurationSet(configurationValue : [1 ], parameterNumber : 4 , size : 1 ). format()
256- }
257- else {
258- zwave. configurationV1. configurationSet(configurationValue : [0 ], parameterNumber : 4 , size : 1 ). format()
259- }
248+ delayBetween(commands, 100 )
260249}
0 commit comments