forked from SmartThingsCommunity/SmartThingsPublic
/
ecobee-thermostat.groovy
2723 lines (2520 loc) · 155 KB
/
ecobee-thermostat.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
/**
* Based on original version Copyright 2015 SmartThings
* Additions Copyright 2016 Sean Kendall Schneyer
* Additions Copyright 2017 Barry A. Burke
*
* 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.
*
* Ecobee Thermostat
*
* Author: SmartThings
* Date: 2013-06-13
*
* Updates by Sean Kendall Schneyer <smartthings@linuxbox.org>
* Date: 2015-12-23
*
* Updates by Barry A. Burke (storageanarchy@gmail.com)
* Date: 2017
* https://github.com/SANdood/SmartThingsPublic/tree/StorageAnarchy-Ecobee
*
* See Github Changelog for complete change history
*
* 1.2.0 - Release of holdHours and thermostat holdAction support
* 1.2.1 - Ensure Mode buttons are enabled properly (esp. after vacation hold ends)
* 1.2.2 - Handle "Auto Away" same as "Hold: Away" (& Auto Home)
* 1.2.3 - Added overcool to operating state display, optimized generateEvent() handling
* 1.2.4 - Fix error in currentProgramName update
* 1.2.5 - Reinstated default icon for the default Temperature tile
* 1.2.6 - Fixed display of Mode & fanMode icons when selected; keep unsupported Modes disabled
* 1.2.7 - Added Awake, Auto Home and Auto Away program icons, changed Vacation airplane to solid blue (for consistency)
* 1.2.8 - Fixed changing setpoint, display of multi-stage heat/cool equipmentOperatingState
* 1.2.9 - Added Wakeup as synonym for Awake
* 1.2.10 - Repaired changing setpoints while in a Hold: or Auto Program
* 1.2.11 - Fixed slider control to show "°" instead of "C"
* 1.2.12 - Work around Google Home erroneously sending setpoint requests in C when stat is in F mode
* 1.2.13 - Added commands for Wakeup & Awake climates (for Smart/SI thermostats)
* 1.2.14 - Workaround for program settings
* 1.2.15 - Fixed typo that caused program changes to fail when logging level > 3
* 1.2.16 - Fixed another typo in setThermostatProgram
* 1.2.17 - Fixed CtoF/FtoC conversions in setHeat/CoolingSetpoint()
* 1.2.18 - Fixed typos in prior fix, added heatCoolMinDelta handling
* 1.2.19 - Hard-coded thermostat commands entry points
* 1.2.20 - Eliminate extraneous temp display between up/down arrows of multiAttributeTile
* 1.2.21a- Fix non-temporary program changes
* 1.2.90- Final release before 1.3.0 transition
*/
def getVersionNum() { return "1.2.90" }
private def getVersionLabel() { return "Ecobee Thermostat, version ${getVersionNum()}" }
import groovy.json.JsonSlurper
metadata {
definition (name: "Ecobee Thermostat", namespace: "smartthings", author: "Barry A. Burke (storageanarchy@gmail.com)") {
capability "Actuator"
capability "Thermostat"
capability "Sensor"
capability "Refresh"
capability "Relative Humidity Measurement"
capability "Temperature Measurement"
// capability "Presence Sensor"
capability "Motion Sensor"
// Extended Set of Thermostat Capabilities
capability "Thermostat Cooling Setpoint"
capability "Thermostat Fan Mode"
capability "Thermostat Heating Setpoint"
capability "Thermostat Mode"
capability "Thermostat Operating State"
capability "Thermostat Setpoint"
capability "Health Check"
command "setTemperature"
command "auxHeatOnly"
command "generateEvent"
command "raiseSetpoint"
command "lowerSetpoint"
command "resumeProgram"
command "setHeatingSetpointDelay"
command "setCoolingSetpointDelay"
command "switchMode"
command "setThermostatProgram"
command "setThermostatMode"
command "setThermostatFanMode"
command "setFanMinOnTime"
command "setFanMinOnTimeDelay"
command "setVacationFanMinOnTime"
command "deleteVacation"
command "cancelVacation"
command "home"
command "present"
// Unfortunately we cannot overload the internal Java/Groovy definition of 'sleep()', and calling this will silently fail (actually, it does a
// "sleep(0)")
// command "sleep"
command "asleep"
command "night" // this is probably the appropriate SmartThings device command to call, matches ST mode
command "away"
command "wakeup"
command "awake"
command "off" // redundant - should be predefined by the Thermostat capability
command "auto"
command "cool"
command "heat"
command "emergencyHeat"
command "emergency"
command "auxHeatOnly"
command "fanOff" // Missing from the Thermostat standard capability set
command "fanAuto"
command "fanCirculate"
command "noOp" // Workaround for formatting issues
command "setStateVariable"
command "doRefresh" // internal use by the refresh button
// Capability "Thermostat"
attribute "temperatureScale", "string"
attribute "thermostatSetpoint","number"
attribute "thermostatStatus","string"
attribute "apiConnected","string"
attribute "ecobeeConnected", "string"
attribute "currentProgramName", "string"
attribute "currentProgramId","string"
attribute "currentProgram","string"
attribute "scheduledProgramName", "string"
attribute "scheduledProgramId","string"
attribute "scheduledProgram","string"
attribute "weatherSymbol", "string"
attribute "debugEventFromParent","string"
attribute "logo", "string"
attribute "timeOfDay", "enum", ["day", "night"]
attribute "lastPoll", "string"
attribute "supportedThermostatModes", "JSON_OBJECT" // enum
attribute "supportedThermostatFanModes", "JSON_OBJECT" // enum
attribute "equipmentStatus", "string"
attribute "humiditySetpoint", "string"
attribute "weatherTemperature", "number"
attribute "decimalPrecision", "number"
attribute "temperatureDisplay", "string"
attribute "equipmentOperatingState", "string"
attribute "coolMode", "string"
attribute "heatMode", "string"
attribute "autoMode", "string"
attribute "heatStages", "number"
attribute "coolStages", "number"
attribute "hasHeatPump", "string"
attribute "hasForcedAir", "string"
attribute "hasElectric", "string"
attribute "hasBoiler", "string"
attribute "hasHumidifier", "string"
attribute "hasDehumidifier", "string"
attribute "auxHeatMode", "string"
attribute "motion", "string"
attribute "heatRangeHigh", "number"
attribute "heatRangeLow", "number"
attribute "coolRangeHigh", "number"
attribute "coolRangeLow", "number"
attribute "heatingSetpointRange", "vector3"
attribute "heatingSetpointMin", "number"
attribute "heatingSetpointMax", "number"
attribute "coolingSetpointRange", "vector3"
attribute "coolingSetpointMin", "number"
attribute "coolingSetpointMax", "number"
attribute "thermostatSetpointRange", "vector3"
attribute "thermostatSetpointMin", "number"
attribute "thermostatSetpointMax", "number"
attribute "heatAtSetpoint", "number"
attribute "coolAtSetpoint", "number"
attribute "heatingSetpointDisplay", "number" // for the Sliders (they don't math.round for their integer displays
attribute "coolingSetpointDisplay", "number"
attribute "newHeatSetpoint", "number"
attribute "newCoolSetpoint", "number"
attribute "heatRange", "string"
attribute "coolRange", "string"
attribute "thermostatHold", "string"
attribute "holdStatus", "string"
attribute "heatDifferential", "number"
attribute "coolDifferential", "number"
attribute "heatCoolMinDelta", "number"
attribute "fanMinOnTime", "number"
attribute "programsList", "enum"
attribute "thermostatOperatingStateDisplay", "string"
attribute "thermostatFanModeDisplay", "string"
attribute "thermostatTime", "string"
attribute "statHoldAction", "string"
attribute "setpointDisplay", "string"
// attribute "debugLevel", "number"
attribute "smart1", "string"
attribute "smart2", "string"
attribute "smart3", "string"
attribute "smart4", "string"
attribute "smart5", "string"
attribute "smart6", "string"
attribute "smart7", "string"
attribute "smart8", "string"
attribute "smart9", "string"
attribute "smart10", "string"
}
simulator { }
tiles(scale: 2) {
multiAttributeTile(name:"temperatureDisplay", type:"thermostat", width:6, height:4, canChangeIcon: true) {
tileAttribute("device.temperatureDisplay", key: "PRIMARY_CONTROL") {
attributeState("default", label:'${currentValue}', unit:"dF", defaultState: true)
}
tileAttribute("device.thermostatSetpoint", key: "VALUE_CONTROL") {
attributeState("VALUE_UP", action: "raiseSetpoint")
attributeState("VALUE_DOWN", action: "lowerSetpoint")
attributeState("default", label: '${currentValue}°', defaultState:true)
// attributeState("default", action: "setTemperature")
}
tileAttribute("device.humidity", key: "SECONDARY_CONTROL") {
attributeState("default", label:'${currentValue}%', unit:"Humidity", defaultState: true)
}
tileAttribute('device.thermostatOperatingStateDisplay', key: "OPERATING_STATE") {
attributeState('idle', backgroundColor:"#d28de0") // ecobee purple/magenta
attributeState('fan only', backgroundColor:"66cc00") // ecobee green
attributeState('heating', backgroundColor:"#ff9c14") // ecobee flame orange
attributeState('cooling', backgroundColor:"#2db9e7") // ecobee snowflake blue
attributeState('heating (smart recovery)', backgroundColor:"#ff9c14") // ecobee flame orange
attributeState('cooling (smart recovery)', backgroundColor:"#2db9e7") // ecobee snowflake blue
attributeState('cooling (overcool)', backgroundColor:"#2db9e7")
attributeState('offline', backgroundColor:"#ff4d4d")
attributeState('off', backGroundColor:"#cccccc") // grey
attributeState('default', /* label: 'idle', */ backgroundColor:"#d28de0", defaultState: true)
}
tileAttribute("device.thermostatMode", key: "THERMOSTAT_MODE") {
attributeState("off", label:'${name}')
attributeState("heat", label:'${name}')
attributeState("cool", label:'${name}')
attributeState("auto", label:'${name}')
attributeState('default', label:'${name}', defaultState: true)
}
tileAttribute("device.heatingSetpoint", key: "HEATING_SETPOINT") {
attributeState("default", label:'${currentValue}°', unit:"dF", defaultState: true)
}
tileAttribute("device.coolingSetpoint", key: "COOLING_SETPOINT") {
attributeState("default", label:'${currentValue}°', unit:"dF", defaultState: true)
}
} // End multiAttributeTile
// Workaround until they fix the Thermostat multiAttributeTile. Only use this one OR the above one, not both
/* multiAttributeTile(name:"summary", type: "lighting", width: 6, height: 4) {
tileAttribute("device.temperature", key: "PRIMARY_CONTROL") {
attributeState("temperature", label:'${currentValue}°', unit:"dF",
backgroundColors: getTempColors(), defaultState: true)
}
tileAttribute("device.nothing", key: "VALUE_CONTROL") {
attributeState("VALUE_UP", action: "raiseSetpoint")
attributeState("VALUE_DOWN", action: "lowerSetpoint")
// attributeState("default", action: "setTemperature")
}
tileAttribute("device.humidity", key: "SECONDARY_CONTROL") {
attributeState("default", label:'${currentValue}%', unit:"%", defaultState: true)
}
tileAttribute("device.thermostatOperatingStateDisplay", key: "OPERATING_STATE") {
attributeState("idle", backgroundColor:"#d28de0") // ecobee purple/magenta
attributeState("fan only", backgroundColor:"#66cc00") // ecobee green
attributeState("heating", backgroundColor:"#ff9c14") // ecobee snowflake blue
attributeState("cooling", backgroundColor:"#2db9e7") // ecobee flame orange
attributeState('heating (smart recovery)', backgroundColor:"#ff9c14") // ecobee flame orange
attributeState('cooling (smart recovery)', backgroundColor:"#2db9e7") // ecobee snowflake blue
attributeState('cooling (overcool)', backgroundColor:"#2db9e7")
attributeState('offline', backgroundColor:"#ff4d4d") // red
attributeState('off', backGroundColor:"#cccccc") // grey
attributeState('default', label: 'idle', backgroundColor:"#d28de0", defaultState: true)
}
tileAttribute("device.thermostatMode", key: "THERMOSTAT_MODE") {
attributeState("off", label:'${name}')
attributeState("heat", label:'${name}')
attributeState("cool", label:'${name}')
attributeState("auto", label:'${name}')
}
tileAttribute("device.heatingSetpoint", key: "HEATING_SETPOINT") {
attributeState("default", label:'${currentValue}°', unit:"dF", defaultState: true)
}
tileAttribute("device.coolingSetpoint", key: "COOLING_SETPOINT") {
attributeState("default", label:'${currentValue}°', unit:"dF", defaultState: true)
}
}
*/
// Show status of the API Connection for the Thermostat
standardTile("apiStatus", "device.apiConnected", width: 1, height: 1) {
state "full", label: "FULL", backgroundColor: "#44b621", icon: "st.contact.contact.closed"
state "warn", label: "WARN", backgroundColor: "#e86d13", icon: "st.contact.contact.open"
state "lost", label: "LOST", backgroundColor: "#bc2323", icon: "st.contact.contact.open"
}
valueTile("temperature", "device.temperature", width: 2, height: 2, canChangeIcon: true, decoration: 'flat') {
// Use the first version below to show Temperature in Device History - will also show Large Temperature when device is default for a room
// The second version will show icon in device lists
//state("default", label:'${currentValue}°', unit:"F", backgroundColors: getTempColors(), defaultState: true)
state("default", label:'${currentValue}°', unit:"F", backgroundColors: getTempColors(), defaultState: true, icon: 'st.Weather.weather2')
}
// these are here just to get the colored icons to diplay in the Recently log in the Mobile App
valueTile("heatingSetpointColor", "device.heatingSetpointDisplay", width: 2, height: 2, canChangeIcon: false, decoration: "flat") {
state("heatingSetpoint", label:'${currentValue}°', unit:"F", backgroundColor:"#ff9c14", defaultState: true)
}
valueTile("coolingSetpointColor", "device.coolingSetpointDisplay", width: 2, height: 2, canChangeIcon: false, decoration: "flat") {
state("coolingSetpoint", label:'${currentValue}°', unit:"F", backgroundColor:"#2db9e7", defaultState: true)
}
valueTile("thermostatSetpointColor", "device.thermostatSetpoint", width: 2, height: 2, canChangeIcon: false, decoration: "flat") {
state("thermostatSetpoint", label:'${currentValue}°', unit:"F", backgroundColors: getTempColors(), defaultState: true)
}
valueTile("weatherTempColor", "device.weatherTemperature", width: 2, height: 2, canChangeIcon: false, decoration: "flat") {
state("weatherTemperature", label:'${currentValue}°', unit:"F", backgroundColors: getStockTempColors(), defaultState: true) // use Fahrenheit scale so that outdoor temps register
}
standardTile("mode", "device.thermostatMode", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "off", action:"heat", label: "Mode: Off", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_off_label.png"
state "heat", action:"cool", label: "Mode: Heat", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_heat.png"
state "cool", action:"auto", label: "Mode: Cool", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_cool.png"
state "auto", action:"off", label: "Mode: Auto", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_auto.png"
// Not included in the button loop, but if already in "auxHeatOnly" pressing button will go to "auto"
state "auxHeatOnly", action:"auto", label: "Mode: Aux Heat", icon: "st.thermostat.emergency-heat"
state "updating", label:"Working", icon: "st.motion.motion.inactive"
}
standardTile("modeShow", "device.thermostatMode", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "off", action:"noOp", label: "Off", nextState: "off", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_off_label.png"
state "heat", action:"noOp", label: "Heat", nextState: "heat", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_heat.png"
state "cool", action:"noOp", label: "Cool", nextState: "cool", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_cool.png"
state "auto", action:"noOp", label: "Auto", nextState: "auto", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_auto.png"
// Not included in the button loop, but if already in "auxHeatOnly" pressing button will go to "auto"
state "auxHeatOnly", action:"noOp", label: 'Aux Heat', icon: "st.thermostat.emergency-heat"
state "emergency", action:"noOp", label: 'Emergency', icon: "st.thermostat.emergency-heat"
state "emergencyHeat", action:"noOp", label: 'Emergency Heat', icon: "st.thermostat.emergency-heat"
state "updating", label: 'Working', icon: "st.motion.motion.inactive"
}
// TODO Use a different color for the one that is active
standardTile("setModeHeat", "device.setModeHeat", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "heat", action:"heat", label: "Heat", nextState: "updating", defaultState: true, icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_heat.png"
state "heat dis", action:"noOp", label: "Heat", nextState: "heat dis", defaultState: true, icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_heat_grey.png"
state "updating", label:"Working", icon: "st.motion.motion.inactive"
}
standardTile("setModeCool", "device.setModeCool", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "cool", action:"cool", label: "Cool", nextState: "updating", defaultState: true, icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_cool.png"
state "cool dis", action:"noOp", label: "Cool", nextState: "cool dis", defaultState: true, icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_cool_grey.png"
state "updating", label:"Working", icon: "st.motion.motion.inactive"
}
standardTile("setModeAuto", "device.setModeAuto", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "auto", action:"auto", label: "Auto", nextState: "updating", defaultState: true, icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_auto.png"
state "auto dis", action:"noOp", label: "Auto", nextState: "auto dis", defaultState: true, icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_auto_grey.png"
state "updating", label:"Working", icon: "st.motion.motion.inactive"
}
standardTile("setModeOff", "device.setModeOff", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "off", action:"off", label: "HVAC Off", nextState: "updating", defaultState: true, icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_off_label.png"
state "off dis", action:"noOp", label: "HVAC Off", nextState: "off dis", defaultState: true, icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_off_label_grey.png"
state "updating", label:"Working", icon: "st.motion.motion.inactive"
}
// This one is the one that will control the icon displayed in device Messages log - but we don't actually use it
standardTile("fanMode", "device.thermostatFanMode", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "on", label:'Fan: On', action:"fanAuto", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on_solid.png"
state "auto", label:'Fan: Auto', action:"fanOn", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on.png"
state "off", label:'Fan: Off', action:"fanAuto", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan.png"
state "circulate", label:'Fan: Circulate', action:"fanAuto", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on-1.png"
state "updating", label:"Working", icon: "st.motion.motion.inactive"
}
standardTile("fanModeLabeled", "device.thermostatFanModeDisplay", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "on", label:'Fan: On', action:"fanCirculate", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on_solid.png"
state "auto", label:'Fan: Auto', action:"fanOn", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on.png"
state "off", label:'Fan: Off', action:"fanAuto", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan.png"
state "circulate", label:'Fan: Circulate', action:"fanAuto", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on-1.png"
state "on dis", label:'Fan: On', action:"noOp", nextState: "on dis", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on_solid_grey.png"
state "auto dis", label:'Fan: Auto', action:"noOp", nextState: "auto dis", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on_grey.png"
state "off dis", label:'Fan: Off', action:"fanCirculate", nextState: "circulate dis", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan.png"
state "circulate dis", label:'Fan: Circulate', action:"fanOff", nextState: "off dis", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on-1.png"
state "updating", label:"Working", icon: "st.motion.motion.inactive"
}
standardTile("fanOffButton", "device.setFanOff", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "off", label:"Fan Off", action:"fanOff", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan.png"
state "off dis", label:"Fan Off", action:"fanOffDisabled", nextState: "off dis", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_grey.png"
state "updating", label:"Working", icon: "st.motion.motion.inactive"
}
standardTile("fanCirculate", "device.setFanCirculate", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "circulate", label:"Fan Circulate", action:"fanCirculate", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_big_solid_nolabel.png"
state "updating", label:"Working", icon: "st.motion.motion.inactive"
}
standardTile("fanModeCycler", "device.thermostatFanModeDisplay", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "auto", action:"fanOn", label: "Fan On", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on_solid.png"
state "on", action:"fanCirculate", label: "Fan Circulate", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on-1.png"
state "off", action:"fanAuto", label: "Fan Auto", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on.png"
state "circulate", action:"fanAuto", label: "Fan Auto", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on.png"
state "on dis", action:"noOp", label: "Fan Circulate", nextState: "on dis", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on-1_grey.png"
state "auto dis", action:"noOp", label: "Fan On", nextState: "auto dis", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on_solid_grey.png"
state "off dis", action:"noOp", label: "Fan Auto", nextState: "off dis", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on_grey.png"
state "circulate dis", action:"noOp", label: "Fan Auto", nextState: "circulate dis", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on_grey.png"
state "updating", label:"Working", icon: "st.motion.motion.inactive"
}
standardTile("fanModeAutoSlider", "device.thermostatFanMode", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "on", action:"fanAuto", nextState: "auto", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/fanmode_auto_slider_off.png"
state "auto", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/fanmode_auto_slider_on.png"
}
standardTile("fanModeOnSlider", "device.thermostatFanMode", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "auto", action:"fanOn", nextState: "auto", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/fanmode_on_slider_off.png"
state "on", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/fanmode_on_slider_on.png"
}
standardTile("upButtonControl", "device.thermostatSetpoint", width: 2, height: 1, inactiveLabel: false, decoration: "flat") {
state "setpoint", action:"raiseSetpoint", icon:"st.thermostat.thermostat-up", defaultState: true
}
valueTile("thermostatSetpoint", "device.thermostatSetpoint", width: 2, height: 2, decoration: "flat") {
state "thermostatSetpoint", label:'${currentValue}°', backgroundColors: getTempColors(), defaultState: true
}
valueTile("currentStatus", "device.thermostatStatus", height: 2, width: 4, decoration: "flat") {
state "thermostatStatus", label:'${currentValue}', backgroundColor:"#ffffff", defaultState: true
}
standardTile("downButtonControl", "device.thermostatSetpoint", height: 1, width: 2, inactiveLabel: false, decoration: "flat") {
state "setpoint", action:"lowerSetpoint", icon:"st.thermostat.thermostat-down", defaultState: true
}
controlTile("circSliderControl", "device.fanMinOnTime", "slider", height: 1, width: 4, inactiveLabel: false, range: "(0..55)" ) {
state "setCircSetpoint", action:"setFanMinOnTimeDelay", backgroundColor:"#aaaaaa", unit: '′', defaultState: true
}
controlTile("heatSliderControl", "device.heatingSetpointDisplay", "slider", height: 1, width: 4, inactiveLabel: false, range: getSliderRange() /* "(15..85)" */ ) {
state "setHeatingSetpoint", action:"setHeatingSetpointDelay", backgroundColor:"#ff9c14", unit: '°', defaultState: true
}
valueTile("heatingSetpoint", "device.heatingSetpoint", height: 1, width: 1, inactiveLabel: false, decoration: "flat") {
state "heat", label:'${currentValue}°', defaultState: true//, unit:"F", backgroundColor:"#ff9c14"
}
controlTile("coolSliderControl", "device.coolingSetpointDisplay", "slider", height: 1, width: 4, inactiveLabel: false, range: getSliderRange() /* "(15..85)" */ ) {
state "setCoolingSetpoint", action:"setCoolingSetpointDelay", backgroundColor:"#2db9e7", unit: '°', defaultState: true
}
valueTile("coolingSetpoint", "device.coolingSetpoint", width: 1, height: 1, inactiveLabel: false, decoration: "flat") {
state "cool", label:'${currentValue}°', defaultState: true //, unit:"F", backgroundColor:"#2db9e7"
}
standardTile("refresh", "device.doRefresh", width: 2, height: 2,inactiveLabel: false, decoration: "flat") {
state "refresh", action:"doRefresh", nextState: 'updating', label: "Refresh", defaultState: true, icon:"https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/ecobee_refresh_green.png"
state "updating", label:"Working", icon: "st.motion.motion.inactive"
}
standardTile("resumeProgram", "device.resumeProgram", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "resume", action:"resumeProgram", nextState: "updating", label:'Resume', icon:"https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/action_resume_program.png"
state "resume dis", action: 'noOp', nextState: 'resume dis', label: 'Resume', icon:"https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/action_resume_program_grey.png"
state "cancel", action:"cancelVacation", nextState: "updating", label:'Cancel', icon:"https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_vacation_airplane_yellow.png"
state "updating", label:"Working", icon: "st.motion.motion.inactive"
}
standardTile("currentProgramIcon", "device.currentProgramName", height: 2, width: 2, inactiveLabel: false, decoration: "flat") {
state "Home", action:"noOp", nextState:'Home', label: 'Home', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_home_blue.png"
state "Away", action:"noOp", nextState:'Away', label: 'Away', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_away_blue.png"
state "Sleep", action:"noOp", nextState:'Sleep', label: 'Sleep', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_asleep_blue.png"
state "Awake", action:"noOp", nextState:'Awake', label: 'Awake', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_awake.png"
state "Wakeup", action:"noOp", nextState:'Wakeup', label: 'Wakeup', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_awake.png"
state "Awake", action:"noOp", nextState:'Awake', label: 'Awake', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_awake.png"
state "Auto", action:"noOp", nextState:'Auto', label: 'Auto', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_generic_chair_blue.png"
state "Auto Away", action:"noOp", nextState:'Auto Away', label: 'Auto Away', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_auto_away.png" // Fix to auto version
state "Auto Home", action:"noOp", nextState:'Auto Home', label: 'Auto Home', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_auto_home.png" // Fix to auto
state "Hold", action:"noOp", nextState:'Hold', label: 'Hold', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_generic_chair_blue.png"
state "Hold: Fan", action:"noOp", nextState:'Hold: Fan', label: "Hold: Fan", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on_solid_blue.png"
state "Hold: Fan On", action:"noOp", nextState:'Hold: Fan on', label: "Hold: Fan On", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on_solid_blue.png"
state "Hold: Fan Auto", action:"noOp", nextState:'Hold: Fan Auto', label: "Hold: Fan Auto", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on_blue.png"
state "Hold: Circulate", action:"noOp", nextState:'Hold: Circulate', label: "Hold: Circulate", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on-1_blue..png"
state "Hold: Home", action:"noOp", nextState:'Hold: Home', label: 'Hold: Home', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_home_blue_solid.png"
state "Hold: Away", action:"noOp", nextState:'Hold: Away', label: 'Hold: Away', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_away_blue_solid.png"
state "Hold: Sleep", action:"noOp", nextState:'Hold: Sleep', label: 'Hold: Sleep', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_asleep_blue_solid.png"
state "Vacation", action:"noOp", nextState:'Vacation', label: 'Vacation', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_vacation_blue_solid.png"
state "Offline", action:"noOp", nextState:'Offline', label: 'Offline', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_black_dot.png"
state "Hold: Temp", action:'noOp', nextState: 'Hold: Temp', label: 'Hold: Temp', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/thermometer_hold.png"
state "Hold: Wakeup", action:"noOp", nextState:'Hold: Wakeup', label: 'Hold: Wakeup', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_awake_blue.png"
state "Hold: Awake", action:"noOp", nextState:'Hold: Awake', label: 'Hold: Awake', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_awake_blue.png"
state "default", action:"noOp", nextState: 'default', label: '${currentValue}', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_generic_chair_blue.png", defaultState: true
}
valueTile("currentProgram", "device.currentProgramName", height: 2, width: 4, inactiveLabel: false, decoration: "flat") {
state "default", label:'Comfort Setting:\n${currentValue}', defaultState: true
}
standardTile("setHome", "device.setHome", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "home", action:"home", nextState: "updating", label:'Home', icon:"https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_home_blue.png"
state "home dis", action:"homeDisabled", nextState: "home dis", label:'Home', icon:"https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_home_grey.png"
state "updating", label:"Working", icon: "st.motion.motion.inactive"
}
standardTile("setAway", "device.setAway", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "away", action:"away", nextState: "updating", label:'Away', icon:"https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_away_blue.png"
state "away dis", action:"awayDisabled", nextState: "away dis", label:'Away', icon:"https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_away_grey.png"
state "updating", label:"Working", icon: "st.motion.motion.inactive"
}
standardTile("setSleep", "device.setSleep", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
// state "sleep", action:"sleep", nextState: "updating", label:'Set Sleep', icon:"st.Bedroom.bedroom2"
// can't call "sleep()" because of conflict with internal definition (it silently fails)
state "sleep", action:"night", nextState: "updating", label:'Sleep', icon:"https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_asleep_blue.png"
state "sleep dis", action:"nightDisabled", nextState: "sleep dis", label:'Sleep', icon:"https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_asleep_grey.png"
state "updating", label:"Working", icon: "st.motion.motion.inactive"
}
standardTile("operatingState", "device.thermostatOperatingState", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "idle", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_idle_purple.png"
state "fan only", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_fan_on_solid.png"
state "heating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_heat.png"
state "cooling", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_cool.png"
state "offline", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/black_dot_only.png"
state "default", label: '${currentValue}', defaultState: true, icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/blank.png"
}
standardTile("operatingStateDisplay", "device.thermostatOperatingStateDisplay", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "idle", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_idle_purple.png"
state "fan only", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_fan_on_solid.png"
state "heating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_heat.png"
state "cooling", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_cool.png"
state "heating (smart recovery)", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_heat.png"
state "cooling (smart recovery)", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_cool.png"
state 'cooling (overcool)', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_cool.png"
state "offline", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/black_dot_only.png"
state "off", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_off_purple.png"
state "default", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/blank.png", label: '${currentValue}', defaultState: true
}
standardTile("equipmentState", "device.equipmentOperatingState", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "idle", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_idle_purple.png"
state "fan only", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_fan_on_solid.png"
state "emergency", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_heat_emergency.png"
state "heat pump", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_heat.png"
state "heat 1", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_heat_1.png"
state "heat 2", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_heat_2.png"
state "heat 3", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_heat_3.png"
state "heat pump 2", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_heat_2.png"
state "heat pump 3", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_heat_3.png"
state "cool 1", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_cool_1.png"
state "cool 2", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_cool_2.png"
state "heating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons//operatingstate_heat.png"
state "cooling", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_cool.png"
state "emergency hum", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_heat_emergency+humid.png"
state "heat pump hum", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_heat+humid.png"
state "heat 1 hum", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_heat_1+humid.png"
state "heat 2 hum", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_heat_2+humid.png"
state "heat 3 hum", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_heat_3+humid.png"
state "heat pump 2 hum", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_heat_2+humid.png"
state "heat pump 3 hum", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_heat_3+humid.png"
state "cool 1 deh", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_cool_1-humid.png"
state "cool 2 deh", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_cool_2-humid.png"
state "heating hum", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_heat+humid.png"
state "cooling deh", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_cool-humid.png"
state "humidifier", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_humidifier_only.png"
state "dehumidifier", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_dehumidifier_only.png"
state "offline", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/black_dot_only.png"
state "off", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_off_purple.png"
state "default", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/blank.png", action:"noOp", label: '${currentValue}', defaultState: true
}
valueTile("humidity", "device.humidity", inactiveLabel: false, decoration: "flat", width: 1, height: 1) {
state("default", label: '${currentValue}%', unit: "%", defaultState: true, backgroundColors: [ //#d28de0")
[value: 10, color: "#0033cc"],
[value: 60, color: "#ff66ff"]
] )
}
valueTile('humiditySetpoint', 'device.humiditySetpoint', inactiveLabel: false, decoration: 'flat', width: 1, height: 1) {
state("default", label: '${currentValue}%', unit: "%", defaultState: true, backgroundColors: [ //#d28de0")
[value: 10, color: "#0033cc"],
[value: 60, color: "#ff66ff"]
] )
}
standardTile("motionState", "device.motion", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "active", action:"noOp", nextState: "active", label:"Motion", icon:"https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/motion_sensor_motion.png"
state "inactive", action: "noOp", nextState: "inactive", label:"No Motion", icon:"https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/motion_sensor_nomotion.png"
state "not supported", action: "noOp", nextState: "not supported", label: "N/A", icon:"https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/notsupported_x.png"
state "unknown", action: "noOp", label:"Offline", nextState: "unknown", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/motion_sensor_noconnection.png"
}
// Weather Tiles and other Forecast related tiles
standardTile("weatherIcon", "device.weatherSymbol", inactiveLabel: false, width: 2, height: 2, decoration: "flat") {
state "-2", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_updating_-2_fc.png" // , label: 'updating...', action: 'noOp'
state "0", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_sunny_00_fc.png" // , label: 'Sunny', action: 'noOp'
state "1", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_partly_cloudy_02_fc.png" // , label: 'Msly Sun', action: 'noOp'
state "2", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_partly_cloudy_02_fc.png" // , label: 'Ptly Cldy', action: 'noOp'
state "3", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_mostly_cloudy_03_fc.png" // , label: 'Msly Cldy', action: 'noOp'
state "4", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons//weather_cloudy_04_fc.png" // , label: 'Cloudy', action: 'noOp'
state "5", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_drizzle_05_fc.png"
state "6", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_rain_06_fc.png"
state "7", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_freezing_rain_07_fc.png"
state "8", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_rain_06_fc.png"
state "9", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_freezing_rain_07_fc.png"
state "10", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_snow_10_fc.png"
state "11", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_flurries_11_fc.png"
state "12", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_freezing_rain_07_fc.png"
state "13", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons//weather_snow_10_fc.png"
state "14", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_freezing_rain_07_fc.png"
state "15", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_thunderstorms_15_fc.png"
state "16", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_windy_16.png"
state "17", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_tornado_17.png"
state "18", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_fog_18_fc.png"
state "19", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_fog_18_fc.png" // Hazy
state "20", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_fog_18_fc.png" // Smoke
state "21", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_fog_18_fc.png" // Dust
// Night Time Icons (Day time Value + 100)
state "100", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_clear_night_100_fc.png" // , label: 'Clear'
state "101", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_partly_cloudy_101_fc.png" // , label: 'Msly Sun'
state "102", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_partly_cloudy_101_fc.png" // , label: 'Ptly Cldy'
state "103", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_mostly_cloudy_103_fc.png" // , label: 'Msly Cldy'
state "104", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_cloudy_04_fc.png" // , label: 'Cloudy'
state "105", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_drizzle_105_fc.png" // , label: 'Drizzle'
state "106", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_rain_106_fc.png" // , label: 'Rain'
state "107", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_freezing_rain_107_fc.png" // , label: 'Frz Rain'
state "108", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_rain_106_fc.png" // , label: 'Rain'
state "109", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_freezing_rain_107_fc.png" // , label: 'Frz Rain'
state "110", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons//weather_night_snow_110_fc.png" // , label: 'Snow'
state "111", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_flurries_111_fc.png" // , label: 'Flurries'
state "112", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_freezing_rain_107_fc.png" // , label: 'Frz Rain'
state "113", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_snow_110_fc.png" // , label: 'Snow'
state "114", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_freezing_rain_107_fc.png" // , label: 'Frz Rain'
state "115", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_thunderstorms_115_fc.png" // , label: 'T-Storms'
state "116", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_windy_16.png" // , label: 'Windy'
state "117", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_tornado_17.png" // , label: 'Tornado'
state "118", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_fog_18_fc.png" // , label: 'Fog'
state "119", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_fog_18_fc.png" // , label: 'Hazy'
state "120", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_fog_18_fc.png" // , label: 'Smoke'
state "121", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_fog_18_fc.png" // , label: 'Dust'
}
standardTile("weatherTemperature", "device.weatherTemperature", width: 2, height: 2, decoration: "flat") {
state "default", action: "noOpWeatherTemperature", nextState: "default", label: 'Out: ${currentValue}°', defaultState: true, icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/thermometer_fc.png"
}
valueTile("lastPoll", "device.lastPoll", height: 1, width: 5, decoration: "flat") {
state "thermostatStatus", label:'Last Poll: ${currentValue}', defaultState: true, backgroundColor:"#ffffff"
}
valueTile("holdStatus", "device.holdStatus", height: 1, width: 4, decoration: "flat") {
state "default", label:'${currentValue}', defaultState: true //, backgroundColor:"#000000", foregroudColor: "#ffffff"
}
standardTile("ecoLogo", "device.logo", inactiveLabel: false, width: 1, height: 1) {
state "default", defaultState: true, icon:"https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/header_ecobeeicon_blk.png"
}
standardTile("oneBuffer", "device.logo", inactiveLabel: false, width: 1, height: 1, decoration: "flat") {
state "default", defaultState: true
}
valueTile("fanMinOnTime", "device.fanMinOnTime", width: 1, height: 1, decoration: "flat") {
state "fanMinOnTime", /*"default", action: "noOp", nextState: "default", */ label: '${currentValue}m/hr', defaultState: true
}
valueTile("tstatDate", "device.tstatDate", width: 1, height: 1, decoration: "flat") {
state "default", /*"default", action: "noOp", nextState: "default", */ label: '${currentValue}', defaultState: true
}
valueTile("tstatTime", "device.tstatTime", width: 1, height: 1, decoration: "flat") {
state "default", /*"default", action: "noOp", nextState: "default", */ label: '${currentValue}', defaultState: true
}
standardTile("commandDivider", "device.logo", inactiveLabel: false, width: 4, height: 1, decoration: "flat") {
state "default", defaultState: true, icon:"https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/command_divider.png"
}
standardTile("circulating", "device.thermostatFanModeDisplay", inactiveLabel: false, width:1, height:1, decoration: "flat") {
state "default", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_fan_on-1_grey.png"
state "circulating", defaultState: true, icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_fan_on_solid-1_grey.png"
}
standardTile("cooling", "device.coolLogo", inactiveLabel: false, width:1, height:1, decoration: "flat") {
state "disabled", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_cool_grey.png"
state "default", defaultState: true, icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_cool.png"
}
standardTile("heating", "device.heatLogo", inactiveLabel: false, width:1, height:1, decoration: "flat") {
state "disabled", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_heat_grey.png"
state "default", defaultState: true, icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/operatingstate_heat.png"
}
main('temperature') // Display current temperature in the things & room lists
details([
// Use this if you are on a fully operational device OS (such as iOS or Android)
"temperatureDisplay",
// Use the lines below if you can't (or don't want to) use the multiAttributeTile version
// To use, uncomment these lines below, and comment out the line above
// "temperature", "humidity", "upButtonControl", "thermostatSetpoint",
// "currentStatus", "downButtonControl",
"equipmentState", "weatherIcon", "refresh",
"currentProgramIcon", "weatherTemperature", "motionState",
'humidity', "holdStatus", 'humiditySetpoint', // "fanMinOnTime",
"tstatDate", "commandDivider", "tstatTime",
"mode", "fanModeLabeled", "resumeProgram",
'heating',"heatSliderControl", "heatingSetpoint",
'cooling',"coolSliderControl", "coolingSetpoint",
'circulating', 'circSliderControl', 'fanMinOnTime',
"fanModeCycler", "fanOffButton", "setModeOff",
"setModeHeat", "setModeCool", "setModeAuto",
"setHome", "setAway", "setSleep",
"apiStatus", "lastPoll"
])
}
preferences {
//section ("Title") {
input "myHoldType", "enum", title: "${getVersionLabel()}\n\nHold Type", description: "When changing temperature or program, use Permanent, Temporary, Hourly, Parent setting or Thermostat setting hold type?\n\nDefault: Ecobee (Connect) setting",
required: false, options:["Permanent", "Temporary", "Hourly", "Parent", "Thermostat"]
input "myHoldHours", "enum", title: "Hourly Hold Time", description: "If Hourly hold, how many hours do you want to hold?\n\nDefault: Ecobee (Connect) setting", required: false, options:[2,4,6,8,12,16,24]
input "smartAuto", "bool", title: "Smart Auto Temp Adjust", description: "This flag allows the temperature to be adjusted manually when the thermostat " +
"is in Auto mode. An attempt to determine if the heat or cool setting should be changed is made automatically.", required: false
//}
}
}
// parse events into attributes
def parse(String description) {
LOG( "parse() --> Parsing '${description}'" )
// Not needed for cloud connected devices
}
def refresh(force=false) {
// No longer require forcePoll on every refresh - just get whatever has changed
LOG("refresh() - calling pollChildren ${force?'(forced)':''}",2,null,'info')
parent.pollChildren(getDeviceId(),force) // tell parent to just poll me silently -- can't pass child/this for some reason
}
def doRefresh() {
// Pressing refresh within 6 seconds of the prior refresh completing will force a complete poll of the Ecobee cloud - otherwise changes only
refresh(state.lastDoRefresh?((now()-state.lastDoRefresh)<6000):false)
sendEvent(name: 'doRefresh', value: 'refresh', isStateChange: true, displayed: false)
resetUISetpoints()
state.lastDoRefresh = now() // reset the timer after the UI has been updated
}
def forceRefresh() {
refresh(true)
}
def installed() {
updated()
}
def updated() {
LOG("${getVersionLabel()} updated",1,null,'trace')
sendEvent(name: 'checkInterval', value: 3900, displayed: false, isStateChange: true) // 65 minutes (we get forcePolled every 60 minutes
resetUISetpoints()
}
void poll() {
LOG("Executing 'poll' using parent SmartApp", 2, null, 'info')
parent.pollChildren(getDeviceId(),false) // tell parent to just poll me silently -- can't pass child/this for some reason
}
// Health Check will ping us based on the frequency we configure in Ecobee (Connect) (derived from poll & watchdog frequency)
def ping() {
LOG("Health Check ping - apiConnected: ${device.currentValue('apiConnected')}, ecobeeConnected: ${device.currentValue('ecobeeConnected')}, checkInterval: ${device.currentValue('checkInterval')} seconds",1,null,'warn')
parent.pollChildren(getDeviceId(),true) // forcePoll just me
}
def generateEvent(Map results) {
def startMS = now()
boolean debugLevelFour = debugLevel(4)
if (debugLevelFour) LOG("generateEvent(): parsing data ${results}", 4)
//LOG("Debug level of parent: ${parent.settings.debugLevel}", 4, null, "debug")
def linkText = getLinkText(device)
def isMetric = wantMetric()
def forceChange = false
def updateTempRanges = false
def precision = device.currentValue('decimalPrecision')
if (precision == null) precision = isMetric ? 1 : 0
Integer objectsUpdated = 0
def supportedThermostatModes = []
if (state.supportedThermostatModes == null) {
// Initialize for those that are updating the DTH with this version
supportedThermostatModes = ['off']
if (device.currentValue('heatMode') == 'true') supportedThermostatModes << 'heat'
if (device.currentValue('coolMode') == 'true') supportedThermostatModes << 'cool'
if (device.currentValue('autoMode') == 'true') supportedThermostatModes << 'auto'
if (device.currentValue('auxHeatMode') == 'true') supportedThermostatModes += ['auxHeatOnly', 'emergency heat']
sendEvent(name: "supportedThermostatModes", value: supportedThermostatModes, displayed: false)
sendEvent(name: "supportedThermostatFanModes", value: fanModes(), displayed: false)
state.supportedThermostatModes = supportedThermostatModes
} else {
supportedThermostatModes = state.supportedThermostatModes
}
if(results) {
results.each { name, value ->
objectsUpdated++
if (debugLevelFour) LOG("generateEvent() - In each loop: object #${objectsUpdated} name: ${name} value: ${value}", 4)
String tempDisplay = ""
def eventFront = [name: name, linkText: linkText, handlerName: name]
def event = [:]
def sendValue = value.toString() // was String
def isChange = /*forceChange ||*/ (name == 'temperature') || isStateChange(device, name, sendValue)
def tMode = (name == 'thermostatMode') ? sendValue : device.currentValue('thermostatMode')
switch (name) {
case 'forced':
forceChange = sendValue as Boolean
break;
case 'heatingSetpoint':
LOG("heatingSetpoint: ${sendValue}",3,null,'info')
if (isChange || forceChange) {
sendEvent(name: 'heatingSetpointDisplay', value: sendValue, descriptionText: "Heating setpoint is ${sendValue}°", /* isStateChange: isChange,*/ displayed: true) // for the slider
objectsUpdated++
if (tMode == 'heat') {
// def displayValue = isMetric ? sendValue : value.toDouble().round(0).toInteger().toString() // Truncate the decimal point
sendEvent(name: 'thermostatSetpoint', value: /*displayValue*/ sendValue, descriptionText: "Thermostat setpoint is ${sendValue}°", displayed: false /*, isStateChange: isChange */)
objectsUpdated++
} else if (tMode == 'auto') {
Double avg = ((value.toDouble() + device.currentValue('coolingSetpointDisplay').toDouble()).toDouble() / 2.0).toDouble().round(precision.toInteger())
sendEvent(name: 'thermostatSetpoint', value: avg.toString(), descriptionText: "Thermostat setpoint average is ${avg}°", displayed: true /*, isStateChange: isChange */)
objectsUpdated++
}
def heatDiff = device.currentValue('heatDifferential')
if (heatDiff == null) heatDiff = 0.0
Double heatAt = ((value.toDouble() - heatDiff.toDouble()).toDouble().round(precision.toInteger()))
sendEvent(name: 'heatAtSetpoint', value: heatAt, /* isStateChange: isChange, */ displayed: false)
objectsUpdated++
if (!device.currentValue('thermostatOperatingState').startsWith('heat')) sendValue = heatAt.toString()
event = eventFront + [value: sendValue, /*descriptionText: "Heating setpoint is ${sendValue}°", isStateChange: isChange,*/ displayed: false]
}
break;
case 'coolingSetpoint':
LOG("coolingSetpoint: ${sendValue}",3,null,'info')
if (isChange || forceChange) {
sendEvent(name: 'coolingSetpointDisplay', value: sendValue, descriptionText: "Cooling setpoint is ${sendValue}°", /* isStateChange: true, */ displayed: true) // for the slider
objectsUpdated++
if (tMode == 'cool') {
//def displayValue = isMetric ? sendValue : ((value.toInteger() == value.toFloat()) ? value.toInteger().toString() : sendValue) // Truncate the decimal point
sendEvent(name: 'thermostatSetpoint', value: /* displayValue */ sendValue, descriptionText: "Thermostat setpoint is ${sendValue}°", displayed: false, /* isStateChange: true */)
objectsUpdated++
} else if (tMode == 'auto') {
Double avg = ((value.toDouble() + device.currentValue('heatingSetpointDisplay').toDouble()).toDouble() / 2.0).toDouble().round(precision.toInteger())
sendEvent(name: 'thermostatSetpoint', value: avg.toString(), descriptionText: "Thermostat setpoint average is ${avg}°", displayed: true, /* isStateChange: true */)
objectsUpdated++
}
def coolDiff = device.currentValue('coolDifferential')
if (coolDiff == null) coolDiff = 0.0
Double coolAt = ((value.toDouble() + coolDiff.toDouble()).toDouble().round(precision.toInteger()))
sendEvent(name: 'coolAtSetpoint', value: coolAt, /* isStateChange: true, */ displayed: false)
objectsUpdated++
if (!device.currentValue('thermostatOperatingState').startsWith('cool')) sendValue = coolAt.toString()
event = eventFront + [value: sendValue, /*descriptionText: "Cooling setpoint is ${sendValue}°", isStateChange: true, */ displayed: false]
}
break;
case 'thermostatSetpoint':
LOG("thermostatSetpoint: ${sendValue}",2,null,'info')
if (isChange || forceChange) {
def displayValue = isMetric ? sendValue : ((value.toInteger() == value.toFloat()) ? value.toInteger().toString() : sendValue) // Truncate the decimal point
if (isChange) event = eventFront + [value: displayValue, descriptionText: "Thermostat setpoint is ${sendValue}°", isStateChange: true, displayed: true]
}
break;
case 'weatherTemperature':
if (isChange) event = eventFront + [value: sendValue, descriptionText: getTemperatureDescriptionText(name, sendValue, linkText), isStateChange: true, displayed: true]
break;
case 'temperature':
//def redisplay = false
if (device.currentValue('thermostatOperatingState') == 'offline') {
tempDisplay = '451°' // As in Fahrenheit 451
} else {
Double dValue = value.toDouble()
// Generate the display value that will preserve decimal positions ending in 0
if (precision == 0) {
tempDisplay = dValue.round(0).toInteger().toString() + '°'
sendValue = dValue.round(0).toInteger()
} else {
tempDisplay = String.format( "%.${precision.toInteger()}f", dValue.round(precision.toInteger())) + '°'
}
//redisplay = (device.currentValue('temperatureDisplay') == '451°'
}
if (isChange) event = eventFront + [value: sendValue, descriptionText: getTemperatureDescriptionText(name, sendValue, linkText), isStateChange: true, displayed: true]
break;
case 'thermostatOperatingState':
// A little tricky, but this is how we display Smart Recovery within the stock Thermostat multiAttributeTile
// thermostatOperatingStateDisplay has the same values as thermostatOperatingState, plus "heating (smart recovery)"
// and "cooling (smart recovery)". We separately update the standard thermostatOperatingState attribute.
if ((sendValue == 'idle') && (device.currentValue('thermostatMode') == 'off')) sendValue = 'off'
isChange = isStateChange(device, 'thermostatOperatingStateDisplay', sendValue)
boolean displayDesc
String descText
String realValue
if (sendValue.contains('(')) {
displayDesc = true // only show this update ThermOpStateDisplay if we are in Smart Recovery
if (sendValue.contains('mart')) descText = 'in Smart Recovery' // equipmentOperatingState will show what is actually running
else if (sendValue.contains('ver')) descText = 'Overcooling to dehumidify'
realValue = sendValue.take(7) // this gets us to back to just heating/cooling
} else {
displayDesc = false // hide this message - is redundant with EquipOpState
descText = sendValue.capitalize()
realValue = sendValue
}
if (isStateChange(device, 'thermostatOperatingStateDisplay', sendValue)) {
sendEvent(name: "thermostatOperatingStateDisplay", value: sendValue, descriptionText: "Thermostat is ${descText}", linkText: linkText,
handlerName: "${name}Display", isStateChange: true, displayed: displayDesc)
objectsUpdated++
}
if (sendValue == 'offline') {
sendEvent(name: "temperatureDisplay", value: "451°", isStateChange: true, displayed: false, descriptionText:
"Fahrenheit 451")
objectsUpdated++
}
// now update thermostatOperatingState - is limited by API to idle, fan only, heating, cooling, pending heat, pending cool, ventilator only
if (isStateChange(device, name, realValue)) {
// First, check if we need to change the Heating at/Heating to temperature values
if (realValue.startsWith('heat')) {
// heatingSetpoint should display actual setpoint for "Heating to..."
def heatSetp = device.currentValue('heatingSetpointDisplay')
sendEvent(name: 'heatingSetpoint', value: heatSetp, descriptionText: "Heating to ${heatSetp}°", displayed: false) // let sendEvent figure out if this is a change
} else {
def heatSetp = device.currentValue('heatAtSetpoint')
sendEvent(name: 'heatingSetpoint', value: heatSetp, descriptionText: "Heating at ${heatSetp}°", displayed: false)
}
if (realValue.startsWith('cool')) {
// coolingSetpoint should display actual setpoint for "Cooling to..."
def coolSetp = device.currentValue('coolingSetpointDisplay')
sendEvent(name: 'coolingSetpoint', value: coolSetp, descriptionText: "Cooling to ${coolSetp}°", displayed: false)
} else {
def coolSetp = device.currentValue('coolAtSetpoint')
sendEvent(name: 'coolingSetpoint', value: coolSetp, descriptionText: "Cooling at ${coolSetp}°", displayed: false)
}
event = eventFront + [value: realValue, descriptionText: "Thermostat is ${realValue}", isStateChange: true, displayed: false]
}
break;
case 'equipmentOperatingState':
if ((sendValue != 'off') && (tMode == 'off')) {
sendValue = 'off'
isChange = isStateChange(device, name, sendValue)
}
if (isChange || forceChange) {
if (sendValue == 'off') {
// force thermostat to appear idle when it is off
sendEvent(name: 'thermostatOperatingState', value: 'idle', descriptionText: 'Thermostat is off', displayed: true /*, isStateChange: true */)
sendEvent(name: 'thermostatOperatingStateDisplay', value: 'off', descriptionText: 'Thermostat is off', displayed: false, /* isStateChange: true */)
objectsUpdated += 2
}
String descText = sendValue.endsWith('deh') ? sendValue.replace('deh', '& dehumidifying') : (sendValue.endsWith('hum') ? sendValue.replace('hum', '& humidifying') : sendValue)
if (!descText.startsWith('heat pump')) {
descText = descText.replace('heat ','heating ')
descText = descText.replace('cool ','cooling ')
}
descText = descText.replace('1', 'stage 1').replace('2', 'stage 2').replace('3', 'stage 3')
event = eventFront + [value: sendValue, descriptionText: "Equipment is ${descText}", isStateChange: isChange, displayed: true]
}
break;
case 'equipmentStatus':
if (isChange) {
String descText = (value == 'idle') ? 'Equipment is idle' : ((value == 'offline') ? 'Equipment is offline' : "Equipment is running ${value}")
event = eventFront + [value: "${value}", descriptionText: descText, isStateChange: true, displayed: false]
}
break;
case 'lastPoll':
if (isChange) event = eventFront + [value: "${value}", descriptionText: "Poll: ${value}", isStateChange: true, displayed: debugLevel(4)]
break;
case 'humidity':
if (isChange) {
def humSetpoint = device.currentValue('humiditySetpoint')
// if (humSetpoint == null) humSetpoint = 0
String setpointText = ((humSetpoint == null) || (humSetpoint == 0)) ? '' : " (setpoint: ${humSetpoint}%)"
event = eventFront + [value: sendValue, descriptionText: "Humidity is ${sendValue}%${setpointText}", isStateChange: true, displayed: true]
}
break;
case 'humiditySetpoint':
if (isChange && (sendValue != '0')) {
def dispValue = sendValue.replaceAll('-', "-\n")
event = eventFront + [value: dispValue, descriptionText: "Humidity setpoint is ${sendValue}%", isStateChange: true, displayed: false]
def hum = device.currentValue('humidity')
if (hum == null) hum = 0
sendEvent( name: 'humidity', value: hum, linkText: linkText, handlerName: 'humidity', descriptionText: "Humidity is ${hum}% (setpoint: ${sendValue}%)", isStateChange: false, displayed: true )
objectsUpdated++
}
break;
case 'currentProgramName':
String progText = ''
if (sendValue == 'Vacation') {
if (device.currentValue('currentProgramName') == 'Offline') disableVacationButtons() // not offline any more
progText = 'Program is Vacation'
sendEvent(name: 'resumeProgram', value: 'cancel', displayed: false, isStateChange: true) // change the button to Cancel Vacation
} else if (sendValue == 'Offline') {
progText = 'Thermostat is Offline'
if (device.currentValue('currentProgramName') != 'Offline') disableAllButtons() // just went offline
} else {
progText = 'Program is '+sendValue.trim().replaceAll(':','')
def buttonValue = (sendValue.startsWith('Hold') || sendValue.startsWith('Auto ')) ? 'resume' : 'resume dis'
sendEvent(name: 'resumeProgram', value: buttonValue, displayed: false, isStateChange: true) // change the button to Resume Program
def currentProgram = device.currentValue('currentProgramName')