/
PE653.groovy
1568 lines (1475 loc) · 68.1 KB
/
PE653.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
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Intermatic PE653 Pool Control System
*
* Original Copyright 2014 bigpunk6
* Updated 2017 KeithR26
*
* 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.
*
* Don't use Cooper Lee's code (vTile_ms, ms_w_vts) he was working on a different implementation than me.
*
* Install my device type then use the Multi-Channel Controll App by SmartThings from the Marketplace under the More section.
*
* Version History
* Ver Date Author Changes
* 1.00 06/15/2016 bigpunk6 Latest version from the original author
* 2.00 07/14/2016 KeithR26 Updates to make this work with Intermatic firmware v3.4
* Added Pool/Spa mode and initial VSP support
* 2.01 08/10/2016 KeithR26 Major UI redesign
* Added 4 switches to set VSP speeds and off
* Added 4 "Multi-channel" endpoints for ST VSP control
* Added configurable Z-Wave delay
* Added PE653 configuration diagnostics in Debug level = High
* Added Version Info in IDE and logs
* Allow changing icon
* 2.02 04/26/2017 KeithR26 Fix Thermostat set for v3.4 firmware (force scale = 0)
* Prototype Pool Light Color Control
* Implement simple "Macros"
* 2.03 05/01/2017 KeithR26 Refresh water temp when UI temp is tapped
* 2.04 05/07/2017 KeithR26 Allow negative temperature offsets. Limit offets to +/- 5 (max supported by PE653)
* 2.05 05/13/2017 KeithR26 Debug version for Android. Never committed to master
* 2.06 05/13/2017 KeithR26 Update to fix Temperature display on Android
*/
metadata {
definition (name: "Intermatic PE653 Pool Control System", author: "KeithR26", namespace: "KeithR26") {
capability "Actuator"
capability "Switch"
capability "Polling"
capability "Configuration"
capability "Refresh"
capability "Temperature Measurement"
capability "Sensor"
capability "Zw Multichannel"
capability "Thermostat"
attribute "operationMode", "string"
attribute "firemanTimeout", "string"
attribute "temperature", "string"
attribute "temperatureOffsets", "string"
attribute "poolspaConfig", "string"
attribute "poolSetpoint", "string"
attribute "spaSetpoint", "string"
attribute "poolSpaMode", "string"
attribute "pumpSpeed", "string"
attribute "lightColor", "string"
attribute "lightCircuits", "string"
attribute "ccVersions", "string"
attribute "VersionInfo", "string"
attribute "ManufacturerInfo", "string"
attribute "groups", "string"
attribute "debugLevel", "string"
attribute "switch1", "string"
attribute "switch2", "string"
attribute "switch3", "string"
attribute "switch4", "string"
attribute "switch5", "string"
attribute "swVSP1", "string"
attribute "swVSP2", "string"
attribute "swVSP3", "string"
attribute "swVSP4", "string"
command "quickSetPool"
command "quickSetSpa"
command "quickGetWaterTemp"
command "setPoolMode"
command "setSpaMode"
command "togglePoolSpaMode"
command "onMulti"
command "offMulti"
command "on1"
command "off1"
command "on2"
command "off2"
command "on3"
command "off3"
command "on4"
command "off4"
command "on5"
command "off5"
command "setVSPSpeed"
command "setVSPSpeed0"
command "setVSPSpeed1"
command "setVSPSpeed2"
command "setVSPSpeed3"
command "setVSPSpeed4"
command "setMode1"
command "setMode2"
command "setMode3"
command "setMode4"
command "setLightColor"
command "setColor"
command "updated"
// command "epCmd"
// command "enableEpEvents"
fingerprint deviceId: "0x1001", inClusters: "0x91,0x73,0x72,0x86,0x81,0x60,0x70,0x85,0x25,0x27,0x43,0x31", outClusters: "0x82"
}
preferences {
input "operationMode1", "enum", title: "Boster/Cleaner Pump",
options:[1:"No",
2:"Uses Circuit-1",
3:"Variable Speed pump Speed-1",
4:"Variable Speed pump Speed-2",
5:"Variable Speed pump Speed-3",
6:"Variable Speed pump Speed-4"]
input "operationMode2", "enum", title: "Pump Type",
options:[0:"1 Speed Pump without Booster/Cleaner",
1:"1 Speed Pump with Booster/Cleaner",
2:"2 Speed Pump without Booster/Cleaner",
3:"2 Speed Pump with Booster/Cleaner",
4:"Variable Speed Pump without Booster/Cleaner",
5:"Variable Speed Pump with Booster/Cleaner",
6:"Reserved 6",
7:"Reserved 7"]
input "poolSpa1", "enum", title: "Pool or Spa",
options:[0:"Pool",
1:"Spa",
2:"Both"]
input "fireman", "enum", title: "Fireman Timeout",
options:["255":"No heater installed",
"0":"No cool down period",
"1":"1 minute",
"2":"2 minute",
"3":"3 minute",
"4":"4 minute",
"5":"5 minute",
"6":"6 minute",
"7":"7 minute",
"8":"8 minute",
"9":"9 minute",
"10":"10 minute",
"11":"11 minute",
"12":"12 minute",
"13":"13 minute",
"14":"14 minute",
"15":"15 minute"]
input "tempOffsetwater", "number", title: "Water temperature offset", range: "-5..5", defaultValue: 0, required: true
input "tempOffsetair", "number",
title: "Air temperature offset - Sets the Offset of the air temerature for the add-on Thermometer in degrees Fahrenheit -5F to +5F", range: "-5..5", defaultValue: 0, required: true
input "debugLevel", "enum", title: "Debug Level", multiple: "true",
options:[0:"Off",
1:"Low",
2:"High"], defaultvalue: 0
input "ZWdelay", "number",
title: "Delay between Z-Wave commands sent (milliseconds). Suggest 1000.", defaultValue: 1000, required: true
//Mode 1
input "M1Label", "text", title: "M1: Display Name:", defaultValue: ""
input "M1Sw1", "enum", title: "M1: Circuit 1 action:", defaultValue: 0,
options:[0:"No Change",
1:"On",
2:"Off"]
input "M1Sw2", "enum", title: "M1: Circuit 2 action:", defaultValue: 0,
options:[0:"No Change",
1:"On",
2:"Off"]
input "M1Sw3", "enum", title: "M1: Circuit 3 action:", defaultValue: 0,
options:[0:"No Change",
1:"On",
2:"Off"]
input "M1Sw4", "enum", title: "M1: Circuit 4 action:", defaultValue: 0,
options:[0:"No Change",
1:"On",
2:"Off"]
input "M1Sw5", "enum", title: "M1: Circuit 5 action:", defaultValue: 0,
options:[0:"No Change",
1:"On",
2:"Off"]
input "M1Mode", "enum", title: "M1: Mode to change to:", defaultValue: 0,
options:[0:"No change",
1:"Pool",
2:"Pool & Set Temperature",
3:"Spa",
4:"Spa & Set Temperature"]
input "M1Temp", "number", title: "M1: Set Temperature to:", range: "40..104", defaultValue: 40
input "M1VSP", "enum", title: "M1: Set VSP Speed to:", defaultValue: 0,
options:[5:"No change",
1:"Speed 1",
2:"Speed 2",
3:"Speed 3",
4:"Speed 4",
0:"Turn off"]
//Mode 2
input "M2Label", "text", title: "M2: Display Name:", defaultValue: ""
input "M2Sw1", "enum", title: "M2: Circuit 1 action:", defaultValue: 0,
options:[0:"No Change",
1:"On",
2:"Off"]
input "M2Sw2", "enum", title: "M2: Circuit 2 action:", defaultValue: 0,
options:[0:"No Change",
1:"On",
2:"Off"]
input "M2Sw3", "enum", title: "M2: Circuit 3 action:", defaultValue: 0,
options:[0:"No Change",
1:"On",
2:"Off"]
input "M2Sw4", "enum", title: "M2: Circuit 4 action:", defaultValue: 0,
options:[0:"No Change",
1:"On",
2:"Off"]
input "M2Sw5", "enum", title: "M2: Circuit 5 action:", defaultValue: 0,
options:[0:"No Change",
1:"On",
2:"Off"]
input "M2Mode", "enum", title: "M2: Mode to change to:", defaultValue: 0,
options:[0:"No change",
1:"Pool",
2:"Pool & Set Temperature",
3:"Spa",
4:"Spa & Set Temperature"]
input "M2Temp", "number", title: "M2: Set Temperature to:", range: "40..104", defaultValue: 40
input "M2VSP", "enum", title: "M2: Set VSP Speed to:", defaultValue: 0,
options:[5:"No change",
1:"Speed 1",
2:"Speed 2",
3:"Speed 3",
4:"Speed 4",
0:"Turn off"]
//Mode 3
input "M3Label", "text", title: "M3: Display Name:", defaultValue: ""
input "M3Sw1", "enum", title: "M3: Circuit 1 action:", defaultValue: 0,
options:[0:"No Change",
1:"On",
2:"Off"]
input "M3Sw2", "enum", title: "M3: Circuit 2 action:", defaultValue: 0,
options:[0:"No Change",
1:"On",
2:"Off"]
input "M3Sw3", "enum", title: "M3: Circuit 3 action:", defaultValue: 0,
options:[0:"No Change",
1:"On",
2:"Off"]
input "M3Sw4", "enum", title: "M3: Circuit 4 action:", defaultValue: 0,
options:[0:"No Change",
1:"On",
2:"Off"]
input "M3Sw5", "enum", title: "M3: Circuit 5 action:", defaultValue: 0,
options:[0:"No Change",
1:"On",
2:"Off"]
input "M3Mode", "enum", title: "M3: Mode to change to:", defaultValue: 0,
options:[0:"No change",
1:"Pool",
2:"Pool & Set Temperature",
3:"Spa",
4:"Spa & Set Temperature"]
input "M3Temp", "number", title: "M3: Set Temperature to:", range: "40..104", defaultValue: 40
input "M3VSP", "enum", title: "M3: Set VSP Speed to:", defaultValue: 0,
options:[5:"No change",
1:"Speed 1",
2:"Speed 2",
3:"Speed 3",
4:"Speed 4",
0:"Turn off"]
//Mode 4
input "M4Label", "text", title: "M4: Display Name:", defaultValue: ""
input "M4Sw1", "enum", title: "M4: Circuit 1 action:", defaultValue: 0,
options:[0:"No Change",
1:"On",
2:"Off"]
input "M4Sw2", "enum", title: "M4: Circuit 2 action:", defaultValue: 0,
options:[0:"No Change",
1:"On",
2:"Off"]
input "M4Sw3", "enum", title: "M4: Circuit 3 action:", defaultValue: 0,
options:[0:"No Change",
1:"On",
2:"Off"]
input "M4Sw4", "enum", title: "M4: Circuit 4 action:", defaultValue: 0,
options:[0:"No Change",
1:"On",
2:"Off"]
input "M4Sw5", "enum", title: "M4: Circuit 5 action:", defaultValue: 0,
options:[0:"No Change",
1:"On",
2:"Off"]
input "M4Mode", "enum", title: "M4: Mode to change to:", defaultValue: 0,
options:[0:"No change",
1:"Pool",
2:"Pool & Set Temperature",
3:"Spa",
4:"Spa & Set Temperature"]
input "M4Temp", "number", title: "M4: Set Temperature to:", range: "40..104", defaultValue: 40
input "M4VSP", "enum", title: "M4: Set VSP Speed to:", defaultValue: 0,
options:[5:"No change",
1:"Speed 1",
2:"Speed 2",
3:"Speed 3",
4:"Speed 4",
0:"Turn off"]
input "C1ColorEnabled", "enum", title: "Circuit 1 Color Light Enable:", defaultValue: 0,
options:[0:"off",
1:"On"]
input "C2ColorEnabled", "enum", title: "Circuit 2 Color Light Enable:", defaultValue: 0,
options:[0:"off",
1:"On"]
input "C3ColorEnabled", "enum", title: "Circuit 3 Color Light Enable:", defaultValue: 0,
options:[0:"off",
1:"On"]
input "C4ColorEnabled", "enum", title: "Circuit 4 Color Light Enable:", defaultValue: 0,
options:[0:"off",
1:"On"]
input "C5ColorEnabled", "enum", title: "Circuit 5 Color Light Enable:", defaultValue: 0,
options:[0:"off",
1:"On"]
}
simulator {
status "on": "command: 2003, payload: FF"
status "off": "command: 2003, payload: 00"
reply "8E010101,delay 800,6007": "command: 6008, payload: 4004"
reply "8505": "command: 8506, payload: 02"
reply "59034002": "command: 5904, payload: 8102003101000000"
reply "6007": "command: 6008, payload: 0002"
reply "600901": "command: 600A, payload: 10002532"
reply "600902": "command: 600A, payload: 210031"
}
// tile definitions
tiles(scale: 2) {
standardTile("mainTile", "device.poolSpaMode", width: 1, height: 1, canChangeIcon: true, canChangeBackground: true) {
state "spa", label: "spa", action: "setPoolMode", icon: "st.Health & Wellness.health2", backgroundColor: "#79b821", nextState: "turningOff"
state "pool", label: "pool", action: "setSpaMode", icon: "st.Health & Wellness.health2", backgroundColor: "#ffffff", nextState: "turningOn"
state "turningOn", label:'Turning on', action: "pool", icon: "st.Health & Wellness.health2", backgroundColor: "#79b821", nextState: "turningOff"
state "turningOff", label:'Turning off', action: "spa", icon: "st.Health & Wellness.health2", backgroundColor: "#ffffff", nextState: "turningOn"
state "disabled", label:'', icon: "st.Health & Wellness.health2", backgroundColor: "#bc2323" //"#ffffff"
}
valueTile("temperatureTile", "device.temperature", width: 2, height: 2, inactiveLabel: true ) {
state "temperature", label:'${currentValue}°', action: "quickGetWaterTemp",
backgroundColors:[
[value: 32, color: "#153591"],
[value: 54, color: "#1e9cbb"],
[value: 64, color: "#90d2a7"],
[value: 74, color: "#44b621"],
[value: 90, color: "#f1d801"],
[value: 98, color: "#d04e00"],
[value: 110, color: "#bc2323"]
]
}
controlTile("poolSliderControl", "device.poolSetpoint", "slider", width: 4, height: 1, inactiveLabel: false, range:"(40..104)") {
state "PoolSetpoint", action:"quickSetPool", backgroundColor:"#d04e00"
}
valueTile("poolSetpoint", "device.poolSetpoint", width: 2, height: 1, inactiveLabel: false, decoration: "flat") {
state "pool", label:'pool ${currentValue}°', backgroundColor:"#ffffff"
}
controlTile("spaSliderControl", "device.spaSetpoint", "slider", width: 4, height: 1, inactiveLabel: false, range:"(40..104)") {
state "SpaSetpoint", action:"quickSetSpa", backgroundColor: "#1e9cbb"
}
valueTile("spaSetpoint", "device.spaSetpoint", width: 2, height: 1, inactiveLabel: false, decoration: "flat") {
state "spa", label:'spa ${currentValue}°', backgroundColor:"#ffffff"
}
controlTile("pumpSpeedSliderControl", "device.pumpSpeed", "slider", width: 4, height: 1, inactiveLabel: false, range:"(0..4)") {
state "pumpSpeed", action:"setVSPSpeed", backgroundColor:"#d04e00"
}
valueTile("pumpSpeed", "device.pumpSpeed", width: 2, height: 1, inactiveLabel: false, decoration: "flat") {
state "pumpSpeed", label:'speed ${currentValue}', backgroundColor:"#ffffff"
}
controlTile("lightColorSliderControl", "device.lightColor", "slider", width: 4, height: 1, inactiveLabel: false, range:"(1..14)") {
state "color", action:"setLightColor", backgroundColor:"#d04e00"
}
// valueTile("temperatureTile", "device.temperature", width: 2, height: 2, inactiveLabel: true) {
valueTile("lightColor", "device.lightColor", width: 2, height: 1, inactiveLabel: true, decoration: "flat") {
state "color", action:"setColor", label:'color ${currentValue}', backgroundColor:"#ffffff"
}
// standardTile("lightColor", "device.lightColor", width: 2, height: 1, inactiveLabel: false, decoration: "flat") {
// state "color", action:"setColor", label:'color ${currentValue}', backgroundColor:"#ffffff", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/Pool.png"
// }
standardTile("poolSpaMode", "device.poolSpaMode", width: 2, height: 2, decoration: "flat") {
state "spa", label: "", action: "setPoolMode", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/spa.png", backgroundColor: "#79b821", nextState: "turningOff"
state "pool", label: "", action: "setSpaMode", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/Pool.png", backgroundColor: "#ffffff", nextState: "turningOn"
state "turningOn", label: 'changing', action: "pool", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/spa.png", backgroundColor: "#79b821", nextState: "turningOff"
state "turningOff", label: 'changing', action: "spa", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/Pool.png", backgroundColor: "#ffffff", nextState: "turningOn"
state "disabled", label:'', icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/all-white.png", backgroundColor: "#ffffff"
}
standardTile("switch1", "device.switch1", width: 1, height: 1, decoration: "flat") {
state "on", label: "on", action: "off1", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/sw1-on.png", backgroundColor: "#79b821", nextState: "turningOff"
state "off", label: "off", action: "on1", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/sw1-off.png", backgroundColor: "#ffffff", nextState: "turningOn"
state "turningOn", label:'Turning on', action: "off1", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/sw1-on.png", backgroundColor: "#79b821", nextState: "turningOff"
state "turningOff", label:'Turning off', action: "on1", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/sw1-off.png", backgroundColor: "#ffffff", nextState: "turningOn"
}
standardTile("switch2", "device.switch2", width: 1, height: 1, decoration: "flat") {
state "on", label: "on", action: "off2", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/sw2-on.png", backgroundColor: "#79b821", nextState: "turningOff"
state "off", label: "off", action: "on2", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/sw2-off.png", backgroundColor: "#ffffff", nextState: "turningOn"
state "turningOn", label:'Turning on', action: "off2", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/sw2-on.png", backgroundColor: "#79b821", nextState: "turningOff"
state "turningOff", label:'Turning off', action: "on2", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/sw2-off.png", backgroundColor: "#ffffff", nextState: "turningOn"
}
standardTile("switch3", "device.switch3", width: 1, height: 1, decoration: "flat") {
state "on", label: "on", action: "off3", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/sw3-on.png", backgroundColor: "#79b821", nextState: "turningOff"
state "off", label: "off", action: "on3", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/sw3-off.png", backgroundColor: "#ffffff", nextState: "turningOn"
state "turningOn", label:'Turning on', action: "off3", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/sw3-on.png", backgroundColor: "#79b821", nextState: "turningOff"
state "turningOff", label:'Turning off', action: "on3", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/sw3-off.png", backgroundColor: "#ffffff", nextState: "turningOn"
}
standardTile("switch4", "device.switch4", width: 1, height: 1, decoration: "flat") {
state "on", label: "on", action: "off4", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/sw4-on.png", backgroundColor: "#79b821", nextState: "turningOff"
state "off", label: "off", action: "on4", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/sw4-off.png", backgroundColor: "#ffffff", nextState: "turningOn"
state "turningOn", label:'Turning on', action: "off4", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/sw4-on.png", backgroundColor: "#79b821", nextState: "turningOff"
state "turningOff", label:'Turning off', action: "on4", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/sw4-off.png", backgroundColor: "#ffffff", nextState: "turningOn"
}
standardTile("switch5", "device.switch5", width: 1, height: 1, decoration: "flat") {
state "on", label: "on", action: "off5", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/sw5-on.png", backgroundColor: "#79b821", nextState: "turningOff"
state "off", label: "off", action: "on5", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/sw5-off.png", backgroundColor: "#ffffff", nextState: "turningOn"
state "turningOn", label:'Turning on', action: "off5", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/sw5-on.png", backgroundColor: "#79b821", nextState: "turningOff"
state "turningOff", label:'Turning off', action: "on5", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/sw5-off.png", backgroundColor: "#ffffff", nextState: "turningOn"
}
standardTile("swVSP1", "device.swVSP1", width: 1, height: 1, decoration: "flat") {
state "off", label: "off", action: "setVSPSpeed1", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/vsp1-off.png", backgroundColor: "#ffffff", nextState: "turningOn"
state "on", label: "on", action: "setVSPSpeed0", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/vsp1-on.png", backgroundColor: "#79b821", nextState: "turningOff"
state "turningOn", label:'Turning on', action: "setVSPSpeed0", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/vsp1-on.png", backgroundColor: "#79b821", nextState: "turningOff"
state "turningOff", label:'Turning off', action: "setVSPSpeed1", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/vsp1-off.png", backgroundColor: "#ffffff", nextState: "turningOn"
state "disabled", label:'', icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/all-white.png",backgroundColor: "#ffffff"
}
standardTile("swVSP2", "device.swVSP2", width: 1, height: 1, decoration: "flat") {
state "off", label: "off", action: "setVSPSpeed2", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/vsp2-off.png", backgroundColor: "#ffffff", nextState: "turningOn"
state "on", label: "on", action: "setVSPSpeed0", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/vsp2-on.png", backgroundColor: "#79b821", nextState: "turningOff"
state "turningOn", label:'Turning on', action: "setVSPSpeed0", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/vsp2-on.png", backgroundColor: "#79b821", nextState: "turningOff"
state "turningOff", label:'Turning off', action: "setVSPSpeed2", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/vsp2-off.png", backgroundColor: "#ffffff", nextState: "turningOn"
state "disabled", label:'', icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/all-white.png",backgroundColor: "#ffffff"
}
standardTile("swVSP3", "device.swVSP3", width: 1, height: 1, decoration: "flat") {
state "off", label: "off", action: "setVSPSpeed3", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/vsp3-off.png", backgroundColor: "#ffffff", nextState: "turningOn"
state "on", label: "on", action: "setVSPSpeed0", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/vsp3-on.png", backgroundColor: "#79b821", nextState: "turningOff"
state "turningOn", label:'Turning on', action: "setVSPSpeed0", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/vsp3-on.png", backgroundColor: "#79b821", nextState: "turningOff"
state "turningOff", label:'Turning off', action: "setVSPSpeed3", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/vsp3-off.png", backgroundColor: "#ffffff", nextState: "turningOn"
state "disabled", label:'', icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/all-white.png",backgroundColor: "#ffffff"
}
standardTile("swVSP4", "device.swVSP4", width: 1, height: 1, decoration: "flat") {
state "off", label: "off", action: "setVSPSpeed4", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/vsp4-off.png", backgroundColor: "#ffffff", nextState: "turningOn"
state "on", label: "on", action: "setVSPSpeed0", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/vsp4-on.png", backgroundColor: "#79b821", nextState: "turningOff"
state "turningOn", label:'Turning on', action: "setVSPSpeed0", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/vsp4-on.png", backgroundColor: "#79b821", nextState: "turningOff"
state "turningOff", label:'Turning off', action: "setVSPSpeed4", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/vsp4-off.png", backgroundColor: "#ffffff", nextState: "turningOn"
state "disabled", label:'', icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/all-white.png",backgroundColor: "#ffffff"
}
standardTile("swM1", "device.swM1", width: 1, height: 1, decoration: "flat") {
state "disabled", label:'', action: "setMode1", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/M1-off.png",backgroundColor: "#ffffff", nextState: "disabled"
}
standardTile("swM2", "device.swM2", width: 1, height: 1, decoration: "flat") {
state "disabled", label:'', action: "setMode2", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/M2-off.png",backgroundColor: "#ffffff", nextState: "disabled"
}
standardTile("swM3", "device.swM3", width: 1, height: 1, decoration: "flat") {
state "disabled", label:'', action: "setMode3", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/M3-off.png",backgroundColor: "#ffffff", nextState: "disabled"
}
standardTile("swM4", "device.swM4", width: 1, height: 1, decoration: "flat") {
state "disabled", label:'', action: "setMode4", icon: "https://raw.githubusercontent.com/KeithR26/Intermatic-PE653/master/M4-off.png", backgroundColor:"#ffffff", nextState: "disabled"
}
valueTile("M1Name", "device.M1Name", width: 2, height: 1, inactiveLabel: false, decoration: "flat") {
state "M1Name", label:'${currentValue}', backgroundColor:"#ffffff", action: "setMode1"
}
valueTile("M2Name", "device.M2Name", width: 2, height: 1, inactiveLabel: false, decoration: "flat") {
state "M2Name", label:'${currentValue}', backgroundColor:"#ffffff", action: "setMode2"
}
valueTile("M3Name", "device.M3Name", width: 2, height: 1, inactiveLabel: false, decoration: "flat") {
state "M3Name", label:'${currentValue}', backgroundColor:"#ffffff", action: "setMode3"
}
valueTile("M4Name", "device.M4Name", width: 2, height: 1, inactiveLabel: false, decoration: "flat") {
state "M4Name", label:'${currentValue}', backgroundColor:"#ffffff", action: "setMode4"
}
standardTile("blank1", "device.blank", width: 1, height: 1, decoration: "flat") {
state "on", icon: "st.Health & Wellness.health2", backgroundColor: "#ffffff"
}
standardTile("refresh", "device.switch", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"
}
standardTile("configure", "device.configure", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "configure", label:'', action:"configuration.configure", icon:"st.secondary.configure"
}
standardTile("blank2", "device.blank", width: 2, height: 2, decoration: "flat") {
state "on", label: "", icon: "st.Health & Wellness.health2", backgroundColor: "#ffffff"
}
main "mainTile"
details([
"blank1",
"switch1","switch2","switch3","switch4","switch5",
"poolSpaMode",
"temperatureTile",
"swVSP1","swVSP2","swVSP3","swVSP4",
"swM1", "M1Name", "swM2", "M2Name", "swM3", "M3Name", "swM4", "M4Name",
"poolSliderControl", "poolSetpoint", "spaSliderControl", "spaSetpoint",
// "pumpSpeedSliderControl", "pumpSpeed",
"configure","refresh", "blank2",
"lightColorSliderControl","lightColor"])
}
}
// Constants for PE653 configuration parameter locations
def getDELAY () {ZWdelay} // How long to delay between commands to device (configured)
def getMIN_DELAY () {"800"} // Minimum delay between commands to device (configured)
def getVERSION () {"Ver 2.06"} // Keep track of handler version
def getPOOL_SPA_SCHED_PARAM () { 21 } // Pool/Spa mode Schedule #3 - 0x15
def getVSP_SCHED_NO (int spd) { (35 + (spd * 3)) } // VSP Speed 1 Schedule #3 - 0x26
def getVSP_SPEED (int sched) { ((sched - 35) / 3) } // Convert from sched to speed
def getVSP_ENABLED () { (operationMode2 >= "4") ? 1 : 0 } // True if a Variable Speed Pump Configured
def getPOOL_SPA_COMBO () { (poolSpa1 == "2") ? 1 : 0 } // True if both Pool and Spa
def getSWITCH_NAME (int instance) {
def swNames = ["switch1","switch2","switch3","switch4","switch5","poolSpaMode","swVSP1","swVSP2","swVSP3","swVSP4"]
return swNames[instance - 1]
}
// Return the list supported command classes by PE653. The following are the versions for firmware v3.4
// ccVersions: {"20":1,"25":1,"27":1,"31":1,"43":1,"60":2,"70":1,"72":1,"73":1,"81":1,"85":1,"86":1,"91":1}
def getSupportedCmdClasses () {[
0x20, // Basic
0x25, // Switch Binary
0x27, // Switch All
0x31, // Sensor Multilevel
0x43, // Thermostat setpoint
0x60, // Multi Instance
0x70, // Configuration
0x72, // Manufacturer Specific
0x73, // Powerlevel
0x81, // Clock
0x85, // Association
0x86, // Version
0x91 // Manufacturer Proprietary
]
}
// Main entry point for messages from the device
def parse(String description) {
def result = null
if (description.startsWith("Err")) {
log.warn "Error in Parse"
result = createEvent(descriptionText:description, isStateChange:true)
} else {
// def cmd = zwave.parse(description, [0x20: 1, 0x25:1, 0x27:1, 0x31:1, 0x43:1, 0x60:3, 0x70:2, 0x81:1, 0x85:1, 0x86: 1, 0x73:1])
def cmd = zwave.parse(description, [0x20: 1, 0x25:1, 0x27:1, 0x31:1, 0x43:1, 0x60:3, 0x70:2, 0x81:1, 0x85:2, 0x86: 1, 0x73:1])
if (debugLevel > "0") {
log.debug(">>>>> ${cmd} - description:$description ")
}
if (cmd) {
result = zwaveEvent(cmd)
} else {
log.debug("----- Parse() parsed to NULL: description:$description")
}
}
delayResponseLog(result)
}
private List setPoolSetpointInternal(Double degrees) {
log.debug "setPoolSetpointInternal degrees=${degrees}"
def cmds = []
def deviceScale = state.scale ?: 1
def deviceScaleString = deviceScale == 2 ? "C" : "F"
def locationScale = getTemperatureScale()
def p = (state.precision == null) ? 1 : state.precision
def convertedDegrees
if (locationScale == "C" && deviceScaleString == "F") {
convertedDegrees = celsiusToFahrenheit(degrees)
} else if (locationScale == "F" && deviceScaleString == "C") {
convertedDegrees = fahrenheitToCelsius(degrees)
} else {
convertedDegrees = degrees
}
deviceScale = 0 // Cannot send scale = 1 to PE653 or it will ignore the request
// log.trace "setPoolSetpoint: setpointType: 1 scale: $deviceScale precision: $p scaledValue: $convertedDegrees"
cmds << zwave.thermostatSetpointV1.thermostatSetpointSet(setpointType: 1, scale: deviceScale, precision: p, scaledValue: convertedDegrees)
cmds << zwave.thermostatSetpointV1.thermostatSetpointGet(setpointType: 1)
// cmds
}
private List setSpaSetpointInternal(Double degrees) {
log.debug "setSpaSetpointInternal degrees=${degrees}"
def cmds = []
def deviceScale = state.scale ?: 1
def deviceScaleString = deviceScale == 2 ? "C" : "F"
def locationScale = getTemperatureScale()
def p = (state.precision == null) ? 1 : state.precision
def convertedDegrees
if (locationScale == "C" && deviceScaleString == "F") {
convertedDegrees = celsiusToFahrenheit(degrees)
} else if (locationScale == "F" && deviceScaleString == "C") {
convertedDegrees = fahrenheitToCelsius(degrees)
} else {
convertedDegrees = degrees
}
deviceScale = 0 // Cannot send scale = 1 to PE653 ver 3.4 or it will ignore the request
// log.trace "setSpaSetpoint: setpointType: 7 scale: $deviceScale precision: $p scaledValue: $convertedDegrees"
cmds << zwave.thermostatSetpointV1.thermostatSetpointSet(setpointType: 7, scale: deviceScale, precision: p, scaledValue: convertedDegrees)
cmds << zwave.thermostatSetpointV1.thermostatSetpointGet(setpointType: 7)
// cmds
}
// Ask the controller for the water temperature
private List getWaterTemp() {
log.debug "getWaterTemp()"
[zwave.sensorMultilevelV1.sensorMultilevelGet()]
}
//Reports
def zwaveEvent(hubitat.zwave.commands.versionv1.VersionReport cmd) {
state.VersionInfo = "Versions: Firmware v${cmd.applicationVersion}.${cmd.applicationSubVersion} DTH: ${VERSION} zWaveLibraryType: ${cmd.zWaveLibraryType} zWaveProtocol: v${cmd.zWaveProtocolVersion}.${cmd.zWaveProtocolSubVersion}"
createEvent(name: "VersionInfo", value: state.VersionInfo, displayed: false, descriptionText: state.VersionInfo)
}
def zwaveEvent(hubitat.zwave.commands.versionv1.VersionCommandClassReport cmd) {
if (cmd.commandClassVersion) {
def cls = String.format("%02X", cmd.requestedCommandClass)
state.ccVersions[cls] = cmd.commandClassVersion
createEvent(name: "ccVersions", value: util.toJson(state.ccVersions), displayed: false, descriptionText:"")
} else {
[]
}
}
def zwaveEvent(hubitat.zwave.commands.thermostatsetpointv1.ThermostatSetpointSupportedReport cmd) {
// log.debug "thermostatSetpointSupportedReport !!!"
def cmds = []
state.cnfSendParmOne = 1 // Resend the request for "Guarenteed response"
state.cnfParallelGets = 0 // Reset for unresponsive parm numbers
if (debugLevel > "1") {
cmds.addAll(nextConfig())
}
cmds
}
// ManufacturerSpecificReport(manufacturerId: 5, manufacturerName: Intermatic, productId: 1619, productTypeId: 20549)
def zwaveEvent(hubitat.zwave.commands.manufacturerspecificv1.ManufacturerSpecificReport cmd) {
log.debug "ManufacturerSpecificReport !!!"
state.ManufacturerInfo = "ManufacturerInfo: manufacturerId: $manufacturerId, manufacturerName: $manufacturerName, productId: $productId, productTypeId: $productTypeId"
createEvent(name: "ManufacturerInfo", value: state.ManufacturerInfo, displayed: true, descriptionText: state.ManufacturerInfo)
}
def zwaveEvent(hubitat.zwave.commands.configurationv2.ConfigurationReport cmd) {
def map = [:]
def cmds = []
def myValue = ""
def externalValue = ""
def paramNum = cmd.parameterNumber
map.value = cmd.configurationValue[0]
map.name = ""
map.displayed = true
switch (paramNum) {
case 1:
map.name = "operationMode"
cmds << createEvent(map)
break;
case 2:
map.name = "firemanTimeout"
cmds << createEvent(map)
break;
case 3:
map.name = "temperatureOffsets"
cmds << createEvent(map)
break;
case POOL_SPA_SCHED_PARAM:
def instance = 6
if ((cmd.size != 4) || (cmd.configurationValue[0] != 0xFF) || (cmd.configurationValue[1] != 0xFF) || (cmd.configurationValue[2] != 0xFF) || (cmd.configurationValue[3] != 0xFF)) {
myValue = "spa"
externalValue = 0xFF
} else {
myValue = "pool"
externalValue = 0x00
}
cmds.addAll(createMultipleEvents (instance, 0x25, 0x03, externalValue, myValue))
break;
case getVSP_SCHED_NO(1):
case getVSP_SCHED_NO(2):
case getVSP_SCHED_NO(3):
case getVSP_SCHED_NO(4):
def int instance = getVSP_SPEED(paramNum) + 6
if ((cmd.size != 4) || (cmd.configurationValue[0] != 0xFF) || (cmd.configurationValue[1] != 0xFF) || (cmd.configurationValue[2] != 0xFF) || (cmd.configurationValue[3] != 0xFF)) {
state.pumpSpeed = getVSP_SPEED(paramNum).toString()
map.value = state.pumpSpeed.toInteger()
map.name = "pumpSpeed"
cmds << createEvent(map)
myValue = "on"
externalValue = 0xFF
} else {
if (paramNum == getVSP_SCHED_NO(4)) {
map.value = state.pumpSpeed.toInteger()
map.name = "pumpSpeed"
cmds << createEvent(map)
}
myValue = "off"
externalValue = 0
}
cmds.addAll(createMultipleEvents (instance, 0x25, 0x03, externalValue, myValue))
break;
}
if (debugLevel > "1") {
// log.trace " map:$map map.name.length():${map.name.length()}"
def lst = [cmd.size]
state.cnfAttemptsLeft[paramNum] = 0
state.cnfParallelGets = state.cnfParallelGets - 1
for (def i=0;i<cmd.size;i++) {
lst << cmd.configurationValue[i]
}
state.cnfData[paramNum] = lst
cmds.addAll(nextConfig())
}
cmds
}
// Display the previous and current configuration data and the differences
private List compareConfig() {
// log.trace "cnfData1:${state.cnfData}"
// log.trace "cnfData2:${state.cnfData2}"
def dif1 = state.cnfData - state.cnfData2
def dif2 = state.cnfData2 - state.cnfData
log.trace "dif1:$dif1"
log.trace "dif2:$dif2"
[]
}
// Save any previous configuration data, then initiializes and initiates a fresh set of queries
private List startConfig() {
if (state.cnfData) {
state.cnfData2 = state.cnfData
} else {
state.cnfData2 = [:]
}
state.cnfData = [:]
state.cnfAttemptsLeft = []
state.cnfParallelGets = 0
state.cnfGetGoal = 10
state.cnfSendParmOne = 1
def cmds = []
for (def i=0;i<=75;i++) {
state.cnfAttemptsLeft[i] = 3
}
state.cnfAttemptsLeft[0] = 2
nextConfig()
}
// Prepare the next batch of configuration queries
private List nextConfig() {
def cmds = []
while ((state.cnfGetGoal > 0) && (state.cnfParallelGets < state.cnfGetGoal)) {
def nextInx = -1
def maxAttemptsLeft = 0
state.cnfAttemptsLeft.eachWithIndex {itm, i ->
if (i > 1 && itm > maxAttemptsLeft) {
nextInx = i
maxAttemptsLeft = itm
}
}
if (nextInx >= 0) {
state.cnfParallelGets = state.cnfParallelGets + 1
state.cnfAttemptsLeft[nextInx] = state.cnfAttemptsLeft[nextInx] - 1
// log.debug "nextConfig() nextInx:$nextInx maxAttemptsLeft:$maxAttemptsLeft cnfParallelGets:${state.cnfParallelGets}"
cmds << zwave.configurationV2.configurationGet(parameterNumber: nextInx)
} else {
state.cnfGetGoal = 0
state.cnfSendParmOne = 0
log.trace "Config Get Complete: cnfData:${state.cnfData}"
compareConfig()
}
}
if (state.cnfSendParmOne == 1) {
cmds << zwave.thermostatSetpointV1.thermostatSetpointSupportedGet()
state.cnfSendParmOne = 0
}
if (state.cnfGetGoal) {
// runIn(5, timerConfig)
}
cmds
}
// Called from runIn timer
def List timerConfig() {
delayResponseLog(restartConfig())
}
// Push out the next batch of configuration queries
private List restartConfig() {
state.cnfParallelGets = 0
state.cnfSendParmOne = 1
nextConfig()
}
def zwaveEvent(hubitat.zwave.commands.sensormultilevelv1.SensorMultilevelReport cmd) {
def map = [:]
map.value = cmd.scaledSensorValue.toString()
map.unit = cmd.scale == 1 ? "F" : "C"
map.name = "temperature"
createEvent(map)
}
def zwaveEvent(hubitat.zwave.commands.thermostatsetpointv1.ThermostatSetpointReport cmd) {
def map = [:]
map.value = cmd.scaledValue.toString()
map.unit = cmd.scale == 1 ? "F" : "C"
map.displayed = true
switch (cmd.setpointType) {
case 1:
map.name = "poolSetpoint"
break;
case 7:
map.name = "spaSetpoint"
break;
default:
return [:]
}
// So we can respond with same format
state.size = cmd.size
state.scale = cmd.scale
state.precision = cmd.precision
createEvent(map)
}
def zwaveEvent(hubitat.zwave.commands.basicv1.BasicReport cmd) {
if (cmd.value == 0) {
createEvent(name: "switch", value: "off")
} else if (cmd.value == 255) {
createEvent(name: "switch", value: "on")
}
}
def zwaveEvent(hubitat.zwave.commands.basicv1.BasicSet cmd) {
def result = []
if (cmd.value == 0) {
result = createEvent(name: "switch", value: "off")
} else if (cmd.value == 255) {
result = createEvent(name: "switch", value: "on")
}
result
}
def zwaveEvent(hubitat.zwave.commands.basicv1.BasicGet cmd) {
def cmds = []
int val = device.currentValue("switch1").equals("on") ? 0xFF : 0
cmds << zwave.basicV1.basicReport(value: val)
delayBetweenLog(cmds)
}
//Fabricate endpoint info based on the number of real endpoints in the device, plus extras for virtual switches
private List createEndpointInfo(int endPoints) {
def eps = []
def int endpointCnt = endPoints + 1 + 4 // 1 for Pool/Spa + 4 for VSP speed
for (def i=1;i<=endpointCnt;i++) {
if (i==1) {
eps << "10012527"
// } else if (i == 7) {
// eps << "110025"
} else {
eps << "100025"
}
}
log.trace "createEndpointInfo(${endPoints}) endpointCnt=${endpointCnt} eps=${eps}"
eps
}
//def zwaveEvent(hubitat.zwave.commands.multiinstancev1.MultiInstanceReport cmd) {
// state.endpointInfo = createEndpointInfo(cmd.instances)
// [ createEvent(name: "epInfo", value: util.toJson(state.endpointInfo), displayed: true, descriptionText:"")]
//}
def zwaveEvent(hubitat.zwave.commands.multiinstancev1.MultiInstanceReport cmd) {
state.endpointInfo = createEndpointInfo(cmd.endpoints)
[ createEvent(name: "epInfo", value: util.toJson(state.endpointInfo), displayed: true, descriptionText:"")]
}
def zwaveEvent(hubitat.zwave.commands.associationv2.AssociationReport cmd) {
[]
}
def zwaveEvent(hubitat.zwave.commands.associationv2.AssociationGroupingsReport cmd) {
state.groups = cmd.supportedGroupings
[]
}
/*
def zwaveEvent(hubitat.zwave.commands.multiinstancev1.MultiChannelCmdEncap cmd) {
log.debug "got here - chan"
def encapsulatedCommand = cmd.encapsulatedCommand([0x32: 3, 0x25: 1, 0x20: 1])
log.debug "encapsulatedCommand: $encapsulatedCommand"
if (encapsulatedCommand) {
if (state.enabledEndpoints.find { it == cmd.sourceEndPoint }) {
def formatCmd = ([cmd.commandClass, cmd.command] + cmd.parameter).collect{ String.format("%02X", it) }.join()
createEvent(name: "epEvent", value: "$cmd.sourceEndPoint:$formatCmd", isStateChange: true, displayed: false, descriptionText: "(fwd to ep $cmd.sourceEndPoint)")
} else {
zwaveEvent(encapsulatedCommand, cmd.sourceEndPoint as Integer)
}
}
}
*/
// Multi-channel event from the device
def zwaveEvent(hubitat.zwave.commands.multiinstancev1.MultiInstanceCmdEncap cmd) {
def rslt = []
def String myStr = (cmd.parameter[0] == 0) ? "off": "on"
def encapsulatedCommand = cmd.encapsulatedCommand([0x32: 3, 0x25: 1, 0x20: 1])
if (encapsulatedCommand) {
rslt.addAll(createMultipleEvents(cmd.instance, cmd.commandClass, cmd.command, cmd.parameter[0], myStr))
} else {
log.warn "MultiInstanceCmdEncap: Could not de-encapsulate!!!"
}
rslt
}
// Used to update our own switches state as well as the exposed Multi-channel switches
private List sendMultipleEvents (Integer instance, Integer cmdClass, Integer cmdVal, Integer externalParm, String myParm) {
if (debugLevel > "1") {
log.debug "..... sendMultipleEvents( instance:$instance, cmdClass:$cmdClass, cmdVal:$cmdVal, externalParm:$externalParm, myParm:$myParm)"
}
def rslt = createMultipleEvents(instance, cmdClass, cmdVal, externalParm, myParm)
rslt.each {e ->
if (debugLevel > "0") {
log.debug "<<<<< Event: $e"
}
sendEvent(e)
}
null
}
// Used to update our own switches state as well as the exposed Multi-channel switches
private List createMultipleEvents (Integer instance, Integer cmdClass, Integer cmdVal, Integer externalParm, String myParm) {
def rslt = []
if (debugLevel > "1") {
log.debug "..... createMultipleEvents( instance:$instance, cmdClass:$cmdClass, cmdVal:$cmdVal, externalParm:$externalParm, myParm:$myParm)"
}
if (state.enabledEndpoints.find { it == instance }) {
def formatCmd = ([cmdClass, cmdVal] + externalParm).collect{ String.format("%02X", it) }.join()
rslt << createEvent(name: "epEvent", value: "$instance:$formatCmd", isStateChange: true, displayed: true, descriptionText: "(fwd to ep $instance)")
} else {
log.trace "CME: CANT'T FIND INSTANCE: $instance enabledEndpoints:${state.enabledEndpoints}"
}
if (cmdClass == 0x25 && cmdVal == 3) {
def sw = getSWITCH_NAME(instance)
rslt << createEvent(name: "$sw", value: "$myParm", isStateChange: true, displayed: true, descriptionText: "($sw set to $myParm)")
}
rslt
}
def zwaveEvent(hubitat.zwave.Command cmd) {
log.warn "Captured zwave command $cmd"
createEvent(descriptionText: "$device.displayName: $cmd", isStateChange: true)
}
//Commands
// Called from the Multi-command SmartApp with a command string separated by commas
def List epCmd(Integer ep, String cmds) {
def rslt = []
if (debugLevel > "0") {
log.debug "+++++ epCmd: ep:$ep cmds:$cmds"
}
cmds.tokenize(",").each {tok ->
def op = null
def val = 0
if (tok.contains('delay')){
} else if (tok.contains('2001FF')){
op = "Set"
val = 0xFF
} else if (tok.contains('200100')) {
op = "Set"
} else if (tok.contains('2001')) {
val = tok[4..5].toInteger()
op = "Set"
log.debug "contained 2001 and parm=${val}"
} else if (tok.contains('2002')) {
op = "Get"
} else if (tok.contains('2502')) {
op = "Get"
} else if (tok.contains('2602')) {
op = "Get"
log.debug "contained 2602 Switch Multi-level Get"
} else {
log.warn "ep Cmd not recognized: $tok"
}
if (op) {
switch (ep) {
case 1:
case 2:
case 3:
case 4:
case 5:
rslt.addAll(epSendToDevice(ep, op, val))
break
case 6:
if (op.equals("Set")) {
rslt.addAll(setPoolSpaMode(val))