forked from erocm123/Hubitat
/
qubino-flush-dimmer.groovy
863 lines (802 loc) · 32.1 KB
/
qubino-flush-dimmer.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
/**
*
* Qubino Flush Dimmer
*
* github: Eric Maycock (erocm123)
* Date: 2017-02-21
* Copyright Eric Maycock
*
* Includes all configuration parameters and ease of advanced configuration.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
* for the specific language governing permissions and limitations under the License.
*
*/
metadata {
definition (name: "Qubino Flush Dimmer", namespace: "erocm123", author: "Eric Maycock") {
capability "Actuator"
capability "Switch"
capability "Switch Level"
capability "Polling"
capability "Refresh"
capability "Sensor"
capability "Relay Switch"
capability "Configuration"
capability "Energy Meter"
capability "Power Meter"
capability "Temperature Measurement"
capability "Health Check"
command "reset"
fingerprint mfr: "0159", prod: "0001", model: "0051"
fingerprint deviceId: "0x1101", inClusters: "0x5E,0x86,0x72,0x5A,0x73,0x20,0x27,0x25,0x26,0x32,0x85,0x8E,0x59,0x70", outClusters: "0x20,0x26"
fingerprint deviceId: "0x1101", inClusters: "0x5E,0x86,0x72,0x5A,0x73,0x20,0x27,0x25,0x26,0x30,0x32,0x60,0x85,0x8E,0x59,0x70", outClusters: "0x20,0x26"
}
preferences {
input description: "Once you change values on this page, the corner of the \"configuration\" icon will change orange until all configuration parameters are updated.", title: "Settings", displayDuringSetup: false, type: "paragraph", element: "paragraph"
generate_preferences(configuration_model())
}
}
def installed() {
logging("installed()", 1)
command(zwave.manufacturerSpecificV1.manufacturerSpecificGet())
createChildDevices()
}
def parse(String description) {
def result = []
if (description != "updated") {
logging("description: $description", 1)
def cmd = zwave.parse(description, [0x20: 1, 0x70: 1, 0x71: 3])
if (cmd) {
result += zwaveEvent(cmd)
}
}
def statusTextmsg = ""
result.each {
if ((it instanceof Map) == true && it.find{ it.key == "name" }?.value == "power") {
statusTextmsg = "${it.value} W ${device.currentValue('energy')? device.currentValue('energy') : "0"} kWh"
}
if ((it instanceof Map) == true && it.find{ it.key == "name" }?.value == "energy") {
statusTextmsg = "${device.currentValue('power')? device.currentValue('power') : "0"} W ${it.value} kWh"
}
}
if (statusTextmsg != "") sendEvent(name:"statusText", value:statusTextmsg, displayed:false)
return result
}
def zwaveEvent(hubitat.zwave.commands.basicv1.BasicReport cmd) {
logging("BasicReport: $cmd", 2)
dimmerEvents(cmd)
}
def zwaveEvent(hubitat.zwave.commands.meterv3.MeterReport cmd) {
logging("MeterReport $cmd", 2)
def event
if (cmd.scale == 0) {
event = createEvent(name: "energy", value: cmd.scaledMeterValue, unit: "kWh")
} else if (cmd.scale == 2) {
event = createEvent(name: "power", value: Math.round(cmd.scaledMeterValue), unit: "W")
}
return event
}
def zwaveEvent(hubitat.zwave.commands.switchbinaryv1.SwitchBinaryReport cmd) {
logging("SwitchBinaryReport: $cmd", 2)
if (cmd.value != 254) {
createEvent(name: "switch", value: cmd.value? "on" : "off", type: "digital")
}
}
def zwaveEvent(hubitat.zwave.commands.switchmultilevelv3.SwitchMultilevelReport cmd) {
logging("SwitchMultilevelReport: $cmd", 2)
dimmerEvents(cmd)
}
def dimmerEvents(hubitat.zwave.Command cmd) {
logging("dimmerEvents: $cmd", 1)
def result = []
def value = (cmd.value ? "on" : "off")
def switchEvent = createEvent(name: "switch", value: value, descriptionText: "$device.displayName was turned $value")
result << switchEvent
if (cmd.value) {
result << createEvent(name: "level", value: cmd.value, unit: "%")
}
if (switchEvent.isStateChange) {
result << response(["delay 3000", zwave.meterV2.meterGet(scale: 2).format()])
}
return result
}
def zwaveEvent(hubitat.zwave.commands.sensormultilevelv5.SensorMultilevelReport cmd)
{
logging("SensorMultilevelReport: $cmd", 2)
def map = [:]
switch (cmd.sensorType) {
case 1:
map.name = "temperature"
def cmdScale = cmd.scale == 1 ? "F" : "C"
map.value = convertTemperatureIfNeeded(cmd.scaledSensorValue, cmdScale, cmd.precision)
map.unit = getTemperatureScale()
logging("Temperature Report: $map.value", 2)
break;
default:
map.descriptionText = cmd.toString()
}
return createEvent(map)
}
def zwaveEvent(hubitat.zwave.commands.manufacturerspecificv2.ManufacturerSpecificReport cmd) {
logging("ManufacturerSpecificReport: $cmd", 2)
if (state.manufacturer != cmd.manufacturerName) {
updateDataValue("manufacturer", cmd.manufacturerName)
}
createEvent(name: "manufacturer", value: cmd.manufacturerName)
}
def zwaveEvent(hubitat.zwave.commands.associationv2.AssociationReport cmd) {
logging("AssociationReport $cmd", 2)
state."association${cmd.groupingIdentifier}" = cmd.nodeId[0]
}
def zwaveEvent(hubitat.zwave.commands.sensorbinaryv2.SensorBinaryReport cmd) {
logging("SensorBinaryReport: $cmd", 2)
}
def zwaveEvent(hubitat.zwave.commands.notificationv3.NotificationReport cmd) {
logging("NotificationReport: $cmd", 2)
def result
if (cmd.notificationType == 2) {
def children = childDevices
def childDevice = children.find{it.deviceNetworkId.endsWith("-i2")}
switch (cmd.event) {
case 0:
switch(settings."i2")
{
case "Motion Sensor Child Device":
childDevice.sendEvent(name: "motion", value: "active")
break
case "Carbon Monoxide Detector Child Device":
childDevice.sendEvent(name: "carbonMonoxide", value: "detected")
break
case "Carbon Dioxide Detector Child Device":
childDevice.sendEvent(name: "carbonDioxide", value: "detected")
break
case "Water Sensor Child Device":
childDevice.sendEvent(name: "water", value: "wet")
break
case "Smoke Detector Child Device":
childDevice.sendEvent(name: "smoke", value: "detected")
break
case "Contact Sensor Child Device":
childDevice.sendEvent(name: "contact", value: "open")
break
case "Momentary Button Child Device":
childDevice.push()
break
}
break
case 2:
switch(settings."i2")
{
case "Motion Sensor Child Device":
childDevice.sendEvent(name: "motion", value: "inactive")
break
case "Carbon Monoxide Detector Child Device":
childDevice.sendEvent(name: "carbonMonoxide", value: "clear")
break
case "Carbon Dioxide Detector Child Device":
childDevice.sendEvent(name: "carbonDioxide", value: "clear")
break
case "Water Sensor Child Device":
childDevice.sendEvent(name: "water", value: "dry")
break
case "Smoke Detector Child Device":
childDevice.sendEvent(name: "smoke", value: "clear")
break
case "Contact Sensor Child Device":
childDevice.sendEvent(name: "contact", value: "closed")
break
case "Momentary Button Child Device":
childDevice.release()
break
}
break
}
}
else if (cmd.notificationType == 5) {
def children = childDevices
def childDevice = children.find{it.deviceNetworkId.endsWith("-i3")}
switch (cmd.event) {
case 0:
switch(settings."i3")
{
case "Motion Sensor Child Device":
childDevice.sendEvent(name: "motion", value: "active")
break
case "Carbon Monoxide Detector Child Device":
childDevice.sendEvent(name: "carbonMonoxide", value: "detected")
break
case "Carbon Dioxide Detector Child Device":
childDevice.sendEvent(name: "carbonDioxide", value: "detected")
break
case "Water Sensor Child Device":
childDevice.sendEvent(name: "water", value: "wet")
break
case "Smoke Detector Child Device":
childDevice.sendEvent(name: "smoke", value: "detected")
break
case "Contact Sensor Child Device":
childDevice.sendEvent(name: "contact", value: "open")
break
case "Momentary Button Child Device":
childDevice.push()
break
}
break
case 2:
switch(settings."i3")
{
case "Motion Sensor Child Device":
childDevice.sendEvent(name: "motion", value: "inactive")
break
case "Carbon Monoxide Detector Child Device":
childDevice.sendEvent(name: "carbonMonoxide", value: "clear")
break
case "Carbon Dioxide Detector Child Device":
childDevice.sendEvent(name: "carbonDioxide", value: "clear")
break
case "Water Sensor Child Device":
childDevice.sendEvent(name: "water", value: "dry")
break
case "Smoke Detector Child Device":
childDevice.sendEvent(name: "smoke", value: "clear")
break
case "Contact Sensor Child Device":
childDevice.sendEvent(name: "contact", value: "closed")
break
case "Momentary Button Child Device":
childDevice.release()
break
}
break
}
}else {
logging("Need to handle this cmd.notificationType: ${cmd.notificationType}", 2)
result = createEvent(descriptionText: cmd.toString(), isStateChange: false)
}
result
}
def zwaveEvent(hubitat.zwave.Command cmd) {
logging("$device.displayName: Unhandled: $cmd", 2)
[:]
}
def on() {
logging("on()", 1)
commands([
zwave.switchMultilevelV3.switchMultilevelSet(value: 0xFF, dimmingDuration: 0x00),
zwave.switchMultilevelV1.switchMultilevelGet()
], 1000)
}
def off() {
logging("off()", 1)
commands([
zwave.switchMultilevelV3.switchMultilevelSet(value: 0x00, dimmingDuration: 0x00),
zwave.switchMultilevelV1.switchMultilevelGet()
], 1000)
}
def setLevel(level, duration=null) {
logging("setLevel($level, $duration)", 1)
if(level > 99) level = 99
if(level < 1) level = 1
int delay = duration ? BigDecimal.valueOf(duration).intValueExact() * 1000 : 1000
commands([
zwave.switchMultilevelV3.switchMultilevelSet(value: level, dimmingDuration: duration ?: 0),
zwave.switchMultilevelV1.switchMultilevelGet()
], delay)
}
def poll() {
logging("poll()", 1)
command(zwave.switchMultilevelV1.switchMultilevelGet())
}
def refresh() {
logging("refresh()", 1)
commands([
zwave.switchMultilevelV1.switchMultilevelGet(),
zwave.meterV2.meterGet(scale: 0),
zwave.meterV2.meterGet(scale: 2),
])
}
def reset() {
logging("reset()", 1)
commands([
zwave.meterV2.meterReset(),
zwave.meterV2.meterGet()
])
}
def ping() {
logging("ping()", 1)
refresh()
}
def configure() {
logging("configure()", 1)
def cmds = []
cmds = update_needed_settings()
if (cmds != []) commands(cmds)
}
def updated()
{
logging("updated()", 1)
if (!childDevices) {
createChildDevices()
}
else if (device.label != state.oldLabel) {
childDevices.each {
def newLabel = "${device.displayName} (i${channelNumber(it.deviceNetworkId)})"
it.setLabel(newLabel)
}
state.oldLabel = device.label
}
if (childDevices) {
def childDevice = childDevices.find{it.deviceNetworkId.endsWith("-i2")}
if (childDevice && settings."i2" && childDevice.typeName != settings."i2") {
changeChildDeviceType(childDevice, settings."i2", 2)
}
childDevice = childDevices.find{it.deviceNetworkId.endsWith("-i3")}
if (childDevice && settings."i3" && childDevice.typeName != settings."i3") {
changeChildDeviceType(childDevice, settings."i3", 3)
}
}
def cmds = []
cmds = update_needed_settings()
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
sendEvent(name:"needUpdate", value: device.currentValue("needUpdate"), displayed:false, isStateChange: true)
if (cmds != []) commands(cmds)
}
def generate_preferences(configuration_model)
{
def configuration = new XmlSlurper().parseText(configuration_model)
configuration.Value.each
{
if(it.@hidden != "true" && it.@disabled != "true"){
switch(it.@type)
{
case ["number"]:
input "${it.@index}", "number",
title:"${it.@label}\n" + "${it.Help}",
range: "${it.@min}..${it.@max}",
defaultValue: "${it.@value}",
displayDuringSetup: "${it.@displayDuringSetup}"
break
case "list":
def items = []
it.Item.each { items << ["${it.@value}":"${it.@label}"] }
input "${it.@index}", "enum",
title:"${it.@label}\n" + "${it.Help}",
defaultValue: "${it.@value}",
displayDuringSetup: "${it.@displayDuringSetup}",
options: items
break
case "decimal":
input "${it.@index}", "decimal",
title:"${it.@label}\n" + "${it.Help}",
range: "${it.@min}..${it.@max}",
defaultValue: "${it.@value}",
displayDuringSetup: "${it.@displayDuringSetup}"
break
case "boolean":
input "${it.@index}", "boolean",
title:"${it.@label}\n" + "${it.Help}",
defaultValue: "${it.@value}",
displayDuringSetup: "${it.@displayDuringSetup}"
break
}
}
}
}
/* Code has elements from other community source @CyrilPeponnet (Z-Wave Parameter Sync). */
def update_current_properties(cmd)
{
def currentProperties = state.currentProperties ?: [:]
currentProperties."${cmd.parameterNumber}" = cmd.configurationValue
def parameterSettings = new XmlSlurper().parseText(configuration_model()).Value.find{it.@index == "${cmd.parameterNumber}"}
if (settings."${cmd.parameterNumber}" != null || parameterSettings.@hidden == "true")
{
if (convertParam(cmd.parameterNumber, parameterSettings.@hidden != "true"? settings."${cmd.parameterNumber}" : parameterSettings.@value) == cmd2Integer(cmd.configurationValue))
{
sendEvent(name:"needUpdate", value:"NO", displayed:false, isStateChange: true)
}
else
{
sendEvent(name:"needUpdate", value:"YES", displayed:false, isStateChange: true)
}
}
state.currentProperties = currentProperties
}
def update_needed_settings()
{
def cmds = []
def currentProperties = state.currentProperties ?: [:]
def configuration = new XmlSlurper().parseText(configuration_model())
def isUpdateNeeded = "NO"
if(!state.association9 || state.association9 == "" || state.association9 != 1){
logging("Setting association group 9", 1)
cmds << zwave.associationV2.associationSet(groupingIdentifier:9, nodeId:zwaveHubNodeId)
cmds << zwave.associationV2.associationGet(groupingIdentifier:9)
}
if(!state.association6 || state.association6 == "" || state.association6 != 1){
logging("Setting association group 6", 1)
cmds << zwave.associationV2.associationSet(groupingIdentifier:6, nodeId:zwaveHubNodeId)
cmds << zwave.associationV2.associationGet(groupingIdentifier:6)
}
configuration.Value.each
{
if ("${it.@setting_type}" == "zwave" && it.@disabled != "true"){
if (currentProperties."${it.@index}" == null)
{
if (it.@setonly == "true"){
logging("Parameter ${it.@index} will be updated to " + convertParam(it.@index.toInteger(), settings."${it.@index}"? settings."${it.@index}" : "${it.@value}"), 2)
def convertedConfigurationValue = convertParam(it.@index.toInteger(), settings."${it.@index}"? settings."${it.@index}" : "${it.@value}")
cmds << zwave.configurationV1.configurationSet(configurationValue: integer2Cmd(convertedConfigurationValue, it.@byteSize.toInteger()), parameterNumber: it.@index.toInteger(), size: it.@byteSize.toInteger())
} else {
isUpdateNeeded = "YES"
logging("Current value of parameter ${it.@index} is unknown", 2)
cmds << zwave.configurationV1.configurationGet(parameterNumber: it.@index.toInteger())
}
}
else if ((settings."${it.@index}" != null || "${it.@hidden}" == "true") && cmd2Integer(currentProperties."${it.@index}") != convertParam(it.@index.toInteger(), "${it.@hidden}" != "true"? settings."${it.@index}" : "${it.@value}"))
{
isUpdateNeeded = "YES"
logging("Parameter ${it.@index} will be updated to " + convertParam(it.@index.toInteger(), "${it.@hidden}" != "true"? settings."${it.@index}" : "${it.@value}"), 2)
def convertedConfigurationValue = convertParam(it.@index.toInteger(), "${it.@hidden}" != "true"? settings."${it.@index}" : "${it.@value}")
cmds << zwave.configurationV1.configurationSet(configurationValue: integer2Cmd(convertedConfigurationValue, it.@byteSize.toInteger()), parameterNumber: it.@index.toInteger(), size: it.@byteSize.toInteger())
cmds << zwave.configurationV1.configurationGet(parameterNumber: it.@index.toInteger())
}
}
}
sendEvent(name:"needUpdate", value: isUpdateNeeded, displayed:false, isStateChange: true)
return cmds
}
def convertParam(number, value) {
def parValue
switch (number){
case 110:
if (value < 0)
parValue = value * -1 + 1000
else
parValue = value
break
default:
parValue = value
break
}
return parValue.toInteger()
}
private def logging(message, level) {
if (logLevel != "0"){
switch (logLevel) {
case "1":
if (level > 1)
log.debug "$message"
break
case "99":
log.debug "$message"
break
}
}
}
/**
* Convert byte values to integer
*/
def cmd2Integer(array) {
switch(array.size()) {
case 1:
array[0]
break
case 2:
((array[0] & 0xFF) << 8) | (array[1] & 0xFF)
break
case 3:
((array[0] & 0xFF) << 16) | ((array[1] & 0xFF) << 8) | (array[2] & 0xFF)
break
case 4:
((array[0] & 0xFF) << 24) | ((array[1] & 0xFF) << 16) | ((array[2] & 0xFF) << 8) | (array[3] & 0xFF)
break
}
}
def integer2Cmd(value, size) {
switch(size) {
case 1:
[value]
break
case 2:
def short value1 = value & 0xFF
def short value2 = (value >> 8) & 0xFF
[value2, value1]
break
case 3:
def short value1 = value & 0xFF
def short value2 = (value >> 8) & 0xFF
def short value3 = (value >> 16) & 0xFF
[value3, value2, value1]
break
case 4:
def short value1 = value & 0xFF
def short value2 = (value >> 8) & 0xFF
def short value3 = (value >> 16) & 0xFF
def short value4 = (value >> 24) & 0xFF
[value4, value3, value2, value1]
break
}
}
def zwaveEvent(hubitat.zwave.commands.configurationv1.ConfigurationReport cmd) {
update_current_properties(cmd)
logging("${device.displayName} parameter '${cmd.parameterNumber}' with a byte size of '${cmd.size}' is set to '${cmd2Integer(cmd.configurationValue)}'", 2)
}
private command(hubitat.zwave.Command cmd) {
if (state.sec) {
zwave.securityV1.securityMessageEncapsulation().encapsulate(cmd).format()
} else {
cmd.format()
}
}
private commands(commands, delay=500) {
delayBetween(commands.collect{ command(it) }, delay)
}
private channelNumber(String dni) {
dni.split("-i")[-1] as Integer
}
private void createChildDevices() {
state.oldLabel = device.label
try {
for (i in 2..3) {
addChildDevice("erocm123", "Contact Sensor Child Device", "${device.deviceNetworkId}-i${i}",
[completedSetup: true, label: "${device.displayName} (i${i})",
isComponent: true, componentName: "i$i", componentLabel: "Input $i"])
}
} catch (e) {
runIn(2, "sendAlert")
}
}
private void changeChildDeviceType(childDevice, deviceType, i) {
log.debug "Changing ${childDevice} to ${deviceType}"
deleteChildDevice(childDevice.deviceNetworkId)
if (deviceType != "Disabled") {
try {
addChildDevice("erocm123", deviceType, "${childDevice.deviceNetworkId}",
[completedSetup: true, label: "${childDevice.displayName}",
isComponent: true, componentName: "i$i", componentLabel: "Input $i"])
} catch (e) {
runIn(2, "sendAlert")
}
}
}
private sendAlert() {
sendEvent(
descriptionText: "Child device creation failed. Please make sure that the \"Contact Sensor Child Device\" is installed and published.",
eventType: "ALERT",
name: "childDeviceCreation",
value: "failed",
displayed: true,
)
}
def configuration_model()
{
'''
<configuration>
<Value type="list" byteSize="1" index="1" label="Input 1 switch type" min="0" max="1" value="1" setting_type="zwave" fw="">
<Help>
Range: 0 to 1
Default: Bi-stable switch type (Toggle)
</Help>
<Item label="Mono-stable switch type (Push button)" value="0" />
<Item label="Bi-stable switch type (Toggle)" value="1" />
</Value>
<Value type="list" byteSize="1" index="2" label="Input 2 switch type" min="0" max="1" value="0" setting_type="zwave" fw="">
<Help>
Range: 0 to 1
Default: Bi-stable switch type (Toggle)
</Help>
<Item label="Mono-stable switch type (Push button)" value="0" />
<Item label="Bi-stable switch type (Toggle)" value="1" />
</Value>
<Value type="list" byteSize="1" index="3" label="Input 2 contact type" min="0" max="1" value="0" setting_type="zwave" fw="">
<Help>
Range: 0 to 1
Default: 0 (NO - Normally Open)
</Help>
<Item label="NO (normally open) input type" value="0" />
<Item label="NC (normally closed) input type" value="1" />
</Value>
<Value type="list" byteSize="1" index="4" label="Input 3 contact type" min="0" max="1" value="0" setting_type="zwave" fw="">
<Help>
Range: 0 to 1
Default: 0 (NO - Normally Open)
</Help>
<Item label="NO (normally open) input type" value="0" />
<Item label="NC (normally closed) input type" value="1" />
</Value>
<Value type="list" byteSize="2" index="10" label="Activate / deactivate functions ALL ON/ALL OFF" min="0" max="255" value="255" setting_type="zwave" fw="">
<Help>
ALL ON active
Range: 0, 1, 2, 255
Default: ALL ON active, ALL OFF active
</Help>
<Item label="ALL ON active, ALL OFF active" value="255" />
<Item label="ALL ON is not active, ALL OFF is not active" value="0" />
<Item label="ALL ON is not active, ALL OFF active" value="1" />
<Item label="ALL ON active, ALL OFF is not active" value="2" />
</Value>
<Value type="number" byteSize="2" index="11" label="Automatic turning off output after set time " min="0" max="32535" value="0" setting_type="zwave" fw="">
<Help>
Range: 0 to 32535
Default: 0 (Disabled)
</Help>
</Value>
<Value type="number" byteSize="2" index="12" label="Automatic turning on output after set time " min="0" max="32535" value="0" setting_type="zwave" fw="">
<Help>
Range: 0 to 32535
Default: 0 (Disabled)
</Help>
</Value>
<Value type="list" byteSize="1" index="20" label="Enable/Disable 3way/Additional Switch" min="0" max="2" value="0" setting_type="zwave" fw="">
<Help>
Dimming is done by push button or switch connected to I1 (by default). Enabling 3way switch, dimming can be controlled by push button or switch connected to I1 and I2.
Range: 0 to 2
Default: Disabled
</Help>
<Item label="Disabled" value="0" />
<Item label="3-way" value="1" />
<Item label="Additional" value="2" />
</Value>
<Value type="list" byteSize="1" index="21" label="Enable/Disable Double click function" min="0" max="1" value="0" setting_type="zwave" fw="">
<Help>
If Double click function is enabled, a fast double click on the push button will set dimming power at maximum dimming value.
Range: 0 to 1
Default: Disabled
</Help>
<Item label="Disabled" value="0" />
<Item label="Enabled" value="1" />
</Value>
<Value type="list" byteSize="1" index="30" label="State of the relay after a power failure" min="0" max="1" value="0" setting_type="zwave" fw="">
<Help>
Range: 0 to 1
Default: 0 (Previous State)
</Help>
<Item label="Previous" value="0" />
<Item label="Off" value="1" />
</Value>
<Value type="number" byteSize="1" index="40" label="Power reporting in Watts on power change %" min="0" max="100" value="5" setting_type="zwave" fw="">
<Help>
Range: 0 (Disabled) to 100
Default: 5 (%)
</Help>
</Value>
<Value type="number" byteSize="2" index="42" label="Power reporting in Watts by time interval" min="0" max="32767" value="0" setting_type="zwave" fw="">
<Help>
Range: 0 to 32767
Default: 0 (Disabled)
</Help>
</Value>
<Value type="number" byteSize="1" index="60" label="Minimum dimming value" min="1" max="98" value="1" setting_type="zwave" fw="">
<Help>
Range: 1 to 98
Default: 1 (%)
</Help>
</Value>
<Value type="number" byteSize="1" index="61" label="Maximum dimming value" min="2" max="99" value="99" setting_type="zwave" fw="">
<Help>
Range: 2 to 99
Default: 99 (%)
</Help>
</Value>
<Value type="number" byteSize="2" index="65" label="Dimming time (soft on/off)" min="50" max="255" value="100" setting_type="zwave" fw="">
<Help>
In 10 ms
Range: 50 to 255
Default: 100 (1000 ms = 1 seconds)
</Help>
</Value>
<Value type="number" byteSize="2" index="66" label="Dimming time when key pressed" min="1" max="255" value="3" setting_type="zwave" fw="">
<Help>
Range: 1 to 255
Default: 3 seconds
</Help>
</Value>
<Value type="list" byteSize="1" index="67" label="Ignore start level" min="0" max="1" value="0" setting_type="zwave" fw="">
<Help>
Range: 0 to 1
Default: Disabled
</Help>
<Item label="Disabled" value="0" />
<Item label="Enabled" value="1" />
</Value>
<Value type="number" byteSize="1" index="68" label="Dimming duration" min="0" max="127" value="0" setting_type="zwave" fw="">
<Help>
Range: 0 to 127
Default: 0 (Dimming duration according to parameter 66)
</Help>
</Value>
<Value type="list" byteSize="1" index="100" label="Enable / Disable Endpoint I2 or select Notification Type and Event" min="0" max="9" value="2" setting_type="zwave" fw="" hidden="true">
<Help>
Range: 0 to 7, 9
Default: Home Security; Motion Detection, unknown location
</Help>
<Item label="Disabled" value="0" />
<Item label="Home Security; Motion Detection" value="1" />
<Item label="Carbon Monoxide; Carbon Monoxide detected" value="2" />
<Item label="Carbon Dioxide; Carbon Dioxide detected" value="3" />
<Item label="Water Alarm; Water Leak detected" value="4" />
<Item label="Heat Alarm; Overheat detected" value="5" />
<Item label="Smoke Alarm; Smoke detected" value="6" />
<Item label="Momentary Button; Button pushed" value="7" />
<Item label="Sensor Binary" value="9" />
</Value>
<Value type="list" byteSize="1" index="101" label="Enable / Disable Endpoint I3 or select Notification Type and Event" min="0" max="9" value="4" setting_type="zwave" fw="" hidden="true">
<Help>
Range: 0 to 7, 9
Default: Home Security; Motion Detection, unknown location
</Help>
<Item label="Disabled" value="0" />
<Item label="Home Security; Motion Detection" value="1" />
<Item label="Carbon Monoxide; Carbon Monoxide detected" value="2" />
<Item label="Carbon Dioxide; Carbon Dioxide detected" value="3" />
<Item label="Water Alarm; Water Leak detected" value="4" />
<Item label="Heat Alarm; Overheat detected" value="5" />
<Item label="Smoke Alarm; Smoke detected" value="6" />
<Item label="Momentary Button; Button pushed" value="7" />
<Item label="Sensor Binary" value="9" />
</Value>
<Value type="list" byteSize="1" index="i2" label="Enable / Disable Endpoint I2 or select Notification Type and Event" min="0" max="9" value="Contact Sensor Child Device" setting_type="preference" fw="">
<Help>
Range: 0 to 7, 9
Default: Home Security; Motion Detection, unknown location
</Help>
<Item label="Disabled" value="Disabled" />
<Item label="Home Security; Motion Detection" value="Motion Sensor Child Device" />
<Item label="Carbon Monoxide; Carbon Monoxide detected" value="Carbon Monoxide Detector Child Device" />
<Item label="Carbon Dioxide; Carbon Dioxide detected" value="Carbon Dioxide Detector Child Device" />
<Item label="Water Alarm; Water Leak detected" value="Water Sensor Child Device" />
<Item label="Smoke Alarm; Smoke detected" value="Smoke Detector Child Device" />
<Item label="Momentary Button; Button pushed" value="Momentary Button Child Device" />
<Item label="Sensor Binary" value="Contact Sensor Child Device" />
</Value>
<Value type="list" byteSize="1" index="i3" label="Enable / Disable Endpoint I3 or select Notification Type and Event" min="0" max="9" value="Contact Sensor Child Device" setting_type="preference" fw="">
<Help>
Range: 0 to 7, 9
Default: Home Security; Motion Detection, unknown location
</Help>
<Item label="Disabled" value="Disabled" />
<Item label="Home Security; Motion Detection" value="Motion Sensor Child Device" />
<Item label="Carbon Monoxide; Carbon Monoxide detected" value="Carbon Monoxide Detector Child Device" />
<Item label="Carbon Dioxide; Carbon Dioxide detected" value="Carbon Dioxide Detector Child Device" />
<Item label="Water Alarm; Water Leak detected" value="Water Sensor Child Device" />
<Item label="Smoke Alarm; Smoke detected" value="Smoke Detector Child Device" />
<Item label="Momentary Button; Button pushed" value="Momentary Button Child Device" />
<Item label="Sensor Binary" value="Contact Sensor Child Device" />
</Value>
<Value type="number" byteSize="2" index="110" label="Temperature sensor offset settings" min="-100" max="100" value="0" setting_type="zwave" fw="">
<Help>
In tenths. i.e. 1 = 0.1C, -15 = -1.5C
Range: -100 to 100
Default: 0
</Help>
</Value>
<Value type="number" byteSize="1" index="120" label="Digital temperature sensor reporting" min="0" max="127" value="5" setting_type="zwave" fw="">
<Help>
Range: 0 to 127
Default: 5 (0.5°C change)
</Help>
</Value>
<Value type="list" byteSize="1" index="250" label="Secure Inclusion" min="0" max="1" value="0" setting_type="zwave" fw="" disabled="true">
<Help>
Range: 0 to 1
Default: Disabled
</Help>
<Item label="Disabled" value="0" />
<Item label="Enabled" value="1" />
</Value>
<Value type="list" index="logLevel" label="Debug Logging Level?" value="0" setting_type="preference" fw="">
<Help>
</Help>
<Item label="None" value="0" />
<Item label="Reports" value="1" />
<Item label="All" value="99" />
</Value>
</configuration>
'''
}