-
Notifications
You must be signed in to change notification settings - Fork 2
/
ecobee-thermostat.groovy
1733 lines (1523 loc) · 87.4 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)
* https://github.com/SANdood/Ecobee
*
* See Changelog for change history
*
* 0.9.12 - Fix for setting custom Thermostat Programs (Comfort Settings)
* 0.9.13 - Add attributes to indicate custom program names to child thermostats (smart1, smart2, etc)
* 0.10.1 - Massive overhaul for performance, efficiency, improved UI, enhanced functionality
* 0.10.2 - Beta release of Barry's updated version
* 0.10.3 - Added support for setVacationFanMinOnTime() and deleteVacation()
* 0.10.4 - Fixed temperatureDisplay
* 0.10.5 - Tuned up device notifications (icons, colors, etc.)
* 0.10.6 - Changed outside temp to use Ecobee stock temperature backgroundColors
* 0.10.7 - Fix heat/cool setpoint tiles
* 0.10.8 - Added programsList attribute - list of available "climates" on this thermostat
* 0.10.9 - Fixed double FtoC conversions
* 0.10.10- holdEndsAt suppression
* 0.10.11- Misc notification cleanup
* 0.10.12- Fixed humiditySetpoint reporting
* 0.10.13- More sendEvent message cleanup; hide all the locally generated events from the notification queue
* 0.10.14- Fixed 'motion' message
* 0.10.15- Fixed resumeProgram tile status'
* 0.10.16- Changed Heat/Cooling Slider UI
* 0.10.17- Work In Process
* 1.0.0 - Preparation for General Release
* 1.0.1 - Added support for Thermostat Offline from Ecobee Cloud
* 1.0.2 - Fixed intermittent update of humidity
*
*/
def getVersionNum() { return "1.0.2" }
private def getVersionLabel() { return "Ecobee Thermostat Version ${getVersionNum()}" }
import groovy.json.JsonSlurper
metadata {
definition (name: "Ecobee Thermostat", namespace: "smartthings", author: "SmartThings") {
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"
command "setTemperature"
command "auxHeatOnly"
command "generateEvent"
command "raiseSetpoint"
command "lowerSetpoint"
command "resumeProgram"
command "switchMode"
command "setThermostatProgram"
command "setFanMinOnTime"
command "setVacationFanMinOnTime"
command "deleteVacation"
command "home"
command "present"
// Unfortunately we cannot overload the internal 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 "fanOff" // Missing from the Thermostat standard capability set
command "noOp" // Workaround for formatting issues
command "setStateVariable"
// Capability "Thermostat"
attribute "temperatureScale", "string"
attribute "thermostatSetpoint","number"
attribute "thermostatStatus","string"
attribute "apiConnected","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 "timeOfDate", "enum", ["day", "night"]
attribute "lastPoll", "string"
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 "heatRange", "string"
attribute "coolRange", "string"
attribute "thermostatHold", "string"
attribute "holdStatus", "string"
attribute "heatDifferential", "number"
attribute "coolDifferential", "number"
attribute "fanMinOnTime", "number"
attribute "programsList", "enum"
attribute "thermostatOperatingStateDisplay", "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) {
tileAttribute("device.temperatureDisplay", key: "PRIMARY_CONTROL") {
attributeState("default", label:'${currentValue}', unit:"dF")
}
tileAttribute("device.temperature", key: "VALUE_CONTROL") {
attributeState("default", action: "setTemperature")
}
tileAttribute("device.humidity", key: "SECONDARY_CONTROL") {
attributeState("default", label:'${currentValue}%', unit:"%")
}
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('offline', backgroundColor:"#ff4d4d")
attributeState('default', label: 'idle', backgroundColor:"#d28de0")
}
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")
}
tileAttribute("device.coolingSetpoint", key: "COOLING_SETPOINT") {
attributeState("default", label:'${currentValue}°', unit:"dF")
}
} // 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())
}
tileAttribute("device.temperature", key: "VALUE_CONTROL") {
attributeState("default", action: "setTemperature")
}
tileAttribute("device.humidity", key: "SECONDARY_CONTROL") {
attributeState("default", label:'${currentValue}%', unit:"%")
}
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('offline', backgroundColor:"#ff4d4d")
attributeState('default', label: 'idle', backgroundColor:"#d28de0")
}
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")
}
tileAttribute("device.coolingSetpoint", key: "COOLING_SETPOINT") {
attributeState("default", label:'${currentValue}°', unit:"dF")
}
}
// Show status of the API Connection for the Thermostat
standardTile("apiStatus", "device.apiConnected", width: 1, height: 1) {
state "full", label: "API", backgroundColor: "#00A0D3", icon: "st.contact.contact.closed"
state "warn", label: "API ", backgroundColor: "#FFFF33", icon: "st.contact.contact.open"
state "lost", label: "API ", backgroundColor: "#ffa81e", icon: "st.contact.contact.open"
}
valueTile("temperature", "device.temperature", width: 2, height: 2, canChangeIcon: false, icon: "st.Home.home1") {
state("temperature", label:'${currentValue}°', unit:"F", backgroundColors: getTempColors())
}
// these are here just to get the colored icons to diplay in the Recently log in the Mobile App
valueTile("heatingSetpointColor", "device.heatingSetpoint", width: 2, height: 2, canChangeIcon: false, icon: "st.Home.home1") {
state("heatingSetpoint", label:'${currentValue}°', unit:"F", backgroundColor:"#ff9c14")
}
valueTile("coolingSetpointColor", "device.coolingSetpoint", width: 2, height: 2, canChangeIcon: false, icon: "st.Home.home1") {
state("coolingSetpoint", label:'${currentValue}°', unit:"F", backgroundColor:"#2db9e7")
}
valueTile("thermostatSetpointColor", "device.thermostatSetpoint", width: 2, height: 2, canChangeIcon: false, icon: "st.Home.home1") {
state("thermostatSetpoint", label:'${currentValue}°', unit:"F", backgroundColors: getTempColors())
}
valueTile("weatherTempColor", "device.weatherTemperature", width: 2, height: 2, canChangeIcon: false, icon: "st.Home.home1") {
state("weatherTemperature", label:'${currentValue}°', unit:"F", backgroundColors: getStockTempColors()) // use Fahrenheit scale so that outdoor temps register
}
standardTile("mode", "device.thermostatMode", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "off", action:"thermostat.heat", label: "Set Mode", nextState: "updating", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/systemmode_off.png"
state "heat", action:"thermostat.cool", label: "Set Mode", nextState: "updating", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/systemmode_heat.png"
state "cool", action:"thermostat.auto", label: "Set Mode", nextState: "updating", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/systemmode_cool.png"
state "auto", action:"thermostat.off", label: "Set Mode", nextState: "updating", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/systemmode_auto.png"
// Not included in the button loop, but if already in "auxHeatOnly" pressing button will go to "auto"
state "auxHeatOnly", action:"thermostat.auto", icon: "st.thermostat.emergency-heat"
state "updating", label:"Working", icon: "st.secondary.secondary"
}
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/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/systemmode_off.png"
state "heat", action:"noOp", label: "Heat", nextState: "heat", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/systemmode_heat.png"
state "cool", action:"noOp", label: "Cool", nextState: "cool", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/systemmode_cool.png"
state "auto", action:"noOp", label: "Auto", nextState: "auto", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/systemmode_auto.png"
// Not included in the button loop, but if already in "auxHeatOnly" pressing button will go to "auto"
state "auxHeatOnly", action:"noOp", icon: "st.thermostat.emergency-heat"
state "updating", label:"Working", icon: "st.secondary.secondary"
}
// TODO Use a different color for the one that is active
standardTile("setModeHeat", "device.thermostatMode", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "heat", action:"thermostat.heat", label: "Heat", nextState: "updating", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/systemmode_heat.png"
state "updating", label:"Working...", icon: "st.secondary.secondary"
}
standardTile("setModeCool", "device.thermostatMode", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "cool", action:"thermostat.cool", label: "Cool", nextState: "updating", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/systemmode_cool.png"
state "updating", label:"Working...", icon: "st.secondary.secondary"
}
standardTile("setModeAuto", "device.thermostatMode", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "auto", action:"thermostat.auto", label: "Auto", nextState: "updating", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/systemmode_auto.png"
state "updating", label:"Working...", icon: "st.secondary.secondary"
}
standardTile("setModeOff", "device.thermostatMode", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "off", action:"thermostat.off", label: "Off", nextState: "updating", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/systemmode_off.png"
state "updating", label:"Working...", icon: "st.secondary.secondary"
}
standardTile("fanModeLabeled", "device.thermostatFanMode", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "on", label:'On', action:"noOp", nextState: "on", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on_solid.png"
state "auto", label:'Auto', action:"noOp", nextState: "auto", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on.png"
state "off", label:'Off', action:"noOp", nextState: "auto", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan.png"
state "circulate", label:'Circulate', action:"noOp", nextState: "circulate", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on.png"
state "updating", label:"Working", icon: "st.secondary.secondary"
}
standardTile("fanOffButton", "device.thermostatFanMode", 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_big_nolabel.png"
state "updating", label:"Working", icon: "st.secondary.secondary"
}
standardTile("fanCirculate", "device.thermostatFanMode", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "circulate", label:"Fan Circulate", action:"thermostat.fanCirculate", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_big_on_nolabel.png"
state "updating", label:"Working", icon: "st.secondary.secondary"
}
standardTile("fanMode", "device.thermostatFanMode", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "on", action:"thermostat.fanAuto", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_big_on_solid_nolabel.png"
state "auto", action:"thermostat.fanOn", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_big_on_nolabel.png"
state "off", action:"thermostat.fanAuto", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_big_nolabel.png"
state "circulate", action:"thermostat.fanAuto", nextState: "updating", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_big_on_nolabel.png"
state "updating", label:"Working", icon: "st.secondary.secondary"
}
standardTile("fanModeAutoSlider", "device.thermostatFanMode", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "on", action:"thermostat.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:"thermostat.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"
}
valueTile("thermostatSetpoint", "device.thermostatSetpoint", width: 2, height: 2, decoration: "flat") {
state "thermostatSetpoint", label:'${currentValue}°',
backgroundColors: getTempColors()
}
valueTile("currentStatus", "device.thermostatStatus", height: 2, width: 4, decoration: "flat") {
state "thermostatStatus", label:'${currentValue}', backgroundColor:"#ffffff"
}
standardTile("downButtonControl", "device.thermostatSetpoint", height: 1, width: 2, inactiveLabel: false, decoration: "flat") {
state "setpoint", action:"lowerSetpoint", icon:"st.thermostat.thermostat-down"
}
controlTile("heatSliderControl", "device.heatingSetpoint", "slider", height: 1, width: 4, inactiveLabel: false, range: getSliderRange() /* "(15..85)" */ ) {
state "setHeatingSetpoint", action:"thermostat.setHeatingSetpoint", backgroundColor:"#ff9c14", unit: 'C'
}
valueTile("heatingSetpoint", "device.heatingSetpoint", height: 1, width: 1, inactiveLabel: false, decoration: "flat") {
state "heat", label:'${currentValue}°'//, unit:"F", backgroundColor:"#ff9c14"
}
controlTile("coolSliderControl", "device.coolingSetpoint", "slider", height: 1, width: 4, inactiveLabel: false, range: getSliderRange() /* "(15..85)" */ ) {
state "setCoolingSetpoint", action:"thermostat.setCoolingSetpoint", backgroundColor:"#2db9e7", unit: 'C'
}
valueTile("coolingSetpoint", "device.coolingSetpoint", width: 1, height: 1, inactiveLabel: false, decoration: "flat") {
state "cool", label:'${currentValue}°' //, unit:"F", backgroundColor:"#2db9e7"
}
standardTile("refresh", "device.thermostatMode", width: 2, height: 2,inactiveLabel: false, decoration: "flat") {
state "default", action:"refresh.refresh", label: "Refresh", icon:"https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/header_ecobeeicon_blk.png"
}
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/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/action_resume_program.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"
}
// TODO: Add icons and handling for Ecobee Comfort Settings
standardTile("currentProgramIcon", "device.currentProgramName", height: 2, width: 2, inactiveLabel: false, decoration: "flat") {
state "Home", action:"noOp", label: 'Home', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_home_blue.png"
state "Away", action:"noOp", label: 'Away', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_away_blue.png"
state "Sleep", action:"noOp", label: 'Sleep', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_asleep_blue.png"
state "Auto Away", action:"noOp", label: 'Auto Away', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_away_blue.png" // Fix to auto version
state "Auto Home", action:"noOp", label: 'Auto Home', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_home_blue.png" // Fix to auto
state "Hold", action:"noOp", label: "Hold Activated", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_generic_chair_blue.png"
state "Hold: Fan", action:"noOp", label: "Hold: Fan", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/systemmode_fan_on_solid.png"
state "Hold: Home", action:"noOp", label: 'Hold: Home', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_home_blue_solid.png"
state "Hold: Away", action:"noOp", label: 'Hold: Away', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_away_blue_solid.png"
state "Hold: Sleep", action:"noOp", label: 'Hold: Sleep', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_asleep_blue_solid.png"
state "Vacation", action: "noOp", label: 'Vacation', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_vacation_airplane_yellow.png"
state "Offline", action: "noOp", label: 'Offline', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_black_dot.png"
state "default", action:"noOp", label: '${currentValue}', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/schedule_generic_chair_blue.png"
}
valueTile("currentProgram", "device.currentProgramName", height: 2, width: 4, inactiveLabel: false, decoration: "flat") {
state "default", label:'Comfort Setting:\n${currentValue}'
}
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 "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 "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 "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/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/operatingstate_heat.png"
state "cooling", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/operatingstate_cool.png"
state "offline", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/black_dot_only.png"
state "default", label: '${currentValue}', 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/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/operatingstate_heat.png"
state "cooling", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/operatingstate_cool.png"
state "heating (smart recovery)", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/operatingstate_heat.png"
state "cooling (smart recovery)", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/operatingstate_cool.png"
state "offline", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/black_dot_only.png"
state "default", label: '${currentValue}', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/blank.png"
}
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/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/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/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/operatingstate_heat.png"
state "cooling", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/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/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/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/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/operatingstate_heat+humid.png"
state "cooling deh", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/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 "default", action:"noOp", label: '${currentValue}', icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/blank.png"
}
valueTile("humidity", "device.humidity", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
state("default", label: '${currentValue}%', unit: "humidity", backgroundColor:"#d28de0")
}
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...',
state "0", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_sunny_00_fc.png" // label: 'Sunny',
state "1", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_partly_cloudy_02_fc.png" // label: 'Few Clouds',
state "2", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_partly_cloudy_02_fc.png"
state "3", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_mostly_cloudy_03_fc.png"
state "4", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons//weather_cloudy_04_fc.png"
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/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/weather_windy_16.png"
state "17", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/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: 'Sunny',
state "101", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_partly_cloudy_101_fc.png" // label: 'Few Clouds',
state "102", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_partly_cloudy_101_fc.png"
state "103", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_mostly_cloudy_103_fc.png"
state "104", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_cloudy_04_fc.png"
state "105", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_drizzle_105_fc.png"
state "106", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_rain_106_fc.png"
state "107", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_freezing_rain_107_fc.png"
state "108", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_rain_106_fc.png"
state "109", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_freezing_rain_107_fc.png"
state "110", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons//weather_night_snow_110_fc.png"
state "111", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_flurries_111_fc.png"
state "112", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_freezing_rain_107_fc.png"
state "113", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_snow_110_fc.png"
state "114", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_freezing_rain_107_fc.png"
state "115", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_night_thunderstorms_115_fc.png"
state "116", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/weather_windy_16.png"
state "117", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/weather_tornado_17.png"
state "118", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_fog_18_fc.png"
state "119", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_fog_18_fc.png" // Hazy
state "120", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_fog_18_fc.png" // Smoke
state "121", icon: "https://raw.githubusercontent.com/SANdood/Ecobee/master/icons/weather_fog_18_fc.png" // Dust
}
standardTile("weatherTemperature", "device.weatherTemperature", width: 2, height: 2, decoration: "flat") {
state "default", action: "noOp", nextState: "default", label: 'Out: ${currentValue}°', icon: //"https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/thermometer.png"
"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}', backgroundColor:"#ffffff"
}
valueTile("holdStatus", "device.holdStatus", height: 1, width: 5, decoration: "flat") {
state "default", label:'${currentValue}' //, backgroundColor:"#000000", foregroudColor: "#ffffff"
}
standardTile("ecoLogo", "device.logo", inactiveLabel: false, width: 1, height: 1) {
state "default", 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"
}
valueTile("fanMinOnTime", "device.fanMinOnTime", width: 1, height: 1, decoration: "flat") {
state "fanMinOnTime", /*"default", action: "noOp", nextState: "default", */ label: 'Fan On\n${currentValue}m/hr'
}
standardTile("commandDivider", "device.logo", inactiveLabel: false, width: 4, height: 1, decoration: "flat") {
state "default", icon:"https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/command_divider.png"
}
standardTile("cooling", "device.logo", inactiveLabel: false, width:1, height:1, decoration: "flat") {
state "default", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/operatingstate_cool.png"
}
standardTile("heating", "device.logo", inactiveLabel: false, width:1, height:1, decoration: "flat") {
state "default", icon: "https://raw.githubusercontent.com/StrykerSKS/SmartThings/master/smartapp-icons/ecobee/png/operatingstate_heat.png"
}
main(["temperature", "temperatureDisplay"])
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",
/* "operatingState", */ "equipmentState", "weatherIcon", "refresh",
"currentProgramIcon", "weatherTemperature", "motionState",
"holdStatus", "fanMinOnTime",
"oneBuffer", "commandDivider", "oneBuffer",
"modeShow", "fanModeLabeled", "resumeProgram",
'cooling',"coolSliderControl", "coolingSetpoint",
'heating',"heatSliderControl", "heatingSetpoint",
"fanMode", "fanModeAutoSlider", "fanModeOnSlider",
// "currentProgram", "apiStatus",
"setHome", "setAway", "setSleep",
"setModeHeat", "setModeCool", "setModeAuto",
"apiStatus", "lastPoll"
// "fanOffButton", "fanCirculate", "setVariable"
])
}
preferences {
section (title: "${getVersionLabel()}") {
input "holdType", "enum", title: "Hold Type", description: "When changing temperature, use Temporary or Permanent hold (default)", required: false, options:["Temporary", "Permanent"]
// TODO: Add a preference for the background color for "idle"
// TODO: Allow for a "smart" Setpoint change in "Auto" mode. Why won't the paragraph show up in the Edit Device screen?
// paragraph "The Smart Auto Temp Adjust flag allows for the temperature to be adjusted manually even when the thermostat is in Auto mode. An attempt to determine if the heat or cool setting should be changed will be made automatically."
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
// input "detailedTracing", "bool", title: "Enable Detailed Tracing", description: true, required: false
}
}
}
// parse events into attributes
def parse(String description) {
LOG( "parse() --> Parsing '${description}'" )
// Not needed for cloud connected devices
}
def refresh() {
LOG("refresh() called")
poll()
}
void poll() {
LOG("Executing 'poll' using parent SmartApp (without child)")
parent.pollChildren(deviceId: getDeviceId(), child: null) // tell parent to just poll me silently -- can't pass child/this for some reason
}
def generateEvent(Map results) {
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 updateTempRanges = false
def precision = device.currentValue("decimalPrecision")
if (!precision) precision = (tempScale == "C") ? 1 : 0
Integer objectsUpdated = 0
if(results) {
results.each { name, value ->
objectsUpdated++
LOG("generateEvent() - In each loop: object #${objectsUpdated} name: ${name} value: ${value}", 4)
String tempDisplay = ""
def eventFront = [name: name, linkText: linkText, handlerName: name]
def event = [:]
String sendValue = value.toString()
def isChange = isStateChange(device, name, sendValue)
switch (name) {
case 'temperature':
case 'heatingSetpoint':
case 'coolingSetpoint':
case 'weatherTemperature':
case 'thermostatSetpoint':
if (isChange) {
//String sendValue = "${value}" // Already rounded to appropriate user precision (except temperature, which is sent in API precision)
event = eventFront + [value: sendValue, descriptionText: getTemperatureDescriptionText(name, value, linkText), isStateChange: true, displayed: true]
if (name=="temperature") {
// Generate the display value that will preserve decimal positions ending in 0
if (precision == 0) {
tempDisplay = value.toDouble().round(0).toInteger().toString() + '°'
} else {
tempDisplay = String.format( "%.${precision.toInteger()}f", value.toDouble().round(precision.toInteger())) + '°'
}
}
}
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.
isChange = isStateChange(device, "${name}Display", sendValue)
boolean displayDesc
String descText
String realValue
if (sendValue.contains('(')) {
displayDesc = true // only show this update ThermOpStateDisplay if we are in Smart Recovery
descText = 'in Smart Recovery' // equipmentOperatingState will show what is actually running
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 (isChange) {
sendEvent(name: "${name}Display", value: sendValue, descriptionText: "Thermostat is ${descText}", linkText: linkText,
handlerName: "${name}Display", isStateChange: true, displayed: displayDesc)
objectsUpdated++
}
// now update thermostatOperatingState - is limited by API to idle, fan only, heating, cooling, pending heat, pending cool
isChange = isStateChange(device, name, realValue)
if (isChange) event = eventFront + [value: realValue, descriptionText: "Thermostat is ${realValue}", isStateChange: true, displayed: false]
break;
case 'equipmentOperatingState':
if (isChange) event = eventFront + [value: "${value}", descriptionText: "Equipment is ${value}", isStateChange: true, 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: true]
break;
case 'humidity':
def humSetpoint = device.currentValue('humiditySetpoint')
if (humSetpoint == null) humSetpoint = 0
String setpointText = (humSetpoint == 0) ? '' : " (setpoint: ${humSetpoint}%)"
if (isChange) event = eventFront + [value: sendValue, descriptionText: "Humidity is ${sendValue}%${setpointText}", isStateChange: true, displayed: true]
break;
case 'humiditySetpoint':
if (isChange && (value.toInteger() != 0)) {
event = eventFront + [value: sendValue, descriptionText: "Humidity setpoint is ${sendValue}%", isStateChange: true, displayed: false]
def hum = device.currentValue('humidity')
if (hum == null) hum = 0
sendEvent( name: 'humidity', linkText: linkText, handlerName: 'humidity', descriptionText: "Humidity is ${hum}% (setpoint: ${sendValue}%)", isStateChange: false, displayed: true )
objectsUpdated++
}
break;
case 'currentProgramName':
String progText = ''
if (sendValue == 'Vacation') {
progText = 'Program is Vacation'
sendEvent(name: 'resumeProgram', value: 'cancel', displayed: false) // change the button to Cancel Vacation
} else if (sendValue == 'Offline') {
progText = 'Thermostat is Offline'
} else {
progText = 'Program is '+sendValue.trim().replaceAll(':','')
// TODO: Should really disable the button if we aren't in Hold: * or Auto: * programs
sendEvent(name: 'resumeProgram', value: 'resume', displayed: false) // change the button to Resume Program
}
if (isChange) event = eventFront + [value: sendValue, descriptionText: progText, isStateChange: true, displayed: true]
break;
case 'apiConnected':
if (isChange) event = eventFront + [value: sendValue, descriptionText: "API Connection is ${value}", isStateChange: true, displayed: true]
break;
case 'weatherSymbol':
case 'timeOfDay':
// Check to see if it is night time, if so change to a night symbol
Integer symbolNum = (name == 'weatherSymbol') ? value.toInteger() : device.currentValue('weatherSymbol').toInteger()
String timeOfDay
if (name == 'timeOfDay') {
timeOfDay = value
objectsUpdated++
} else {
timeOfDay = device.currentValue('timeOfDay')
}
if ((timeOfDay == 'night') && (symbolNum < 100)) {
symbolNum = symbolNum + 100
} else if ((timeOfDay == 'day') && (symbolNum >= 100)) {
symbolNum = symbolNum - 100
}
isChange = isStateChange(device, 'weatherSymbol', symbolNum.toString())
if (isChange) event = [name: 'weatherSymbol', linkText: linkText, handlerName: 'weatherSymbol', value: "${symbolNum}", descriptionText: "Weather Symbol is ${symbolNum}", isStateChange: true, displayed: true]
sendEvent( name: 'timeOfDay', value: timeOfDay, displayed: false )
break;
case 'thermostatHold':
if (isChange) {
String descText = (sendValue == '') ? 'Hold finished' : (value == 'hold') ? "Hold ${device.currentValue('currentProgram')} (${device.currentValue('scheduledProgram')})" : "Hold for ${sendValue}"
event = eventFront + [value: sendValue, descriptionText: descText, isStateChange: true, displayed: true]
}
break;
case 'holdStatus':
if (isChange) event = eventFront + [value: sendValue, descriptionText: sendValue, isStateChange: true, displayed: (value != '')]
break;
case 'motion':
if (isChange) event = eventFront + [value: sendValue, descriptionText: "Motion is ${sendValue}", isStateChange: true, displayed: true]
break;
case 'fanMinOnTime':
if (isChange) event = eventFront + [value: sendValue, descriptionText: "Fan On ${sendValue} minutes per hour", isStateChange: true, displayed: true]
break;
case 'thermostatMode':
if (isChange) event = eventFront + [value: sendValue, descriptionText: "Mode is ${sendValue}", isStateChange: true, displayed: true]
break;
case 'thermostatFanMode':
if (isChange) event = eventFront + [value: sendValue, descriptionText: "Fan Mode is ${sendValue}", isStateChange: true, displayed: true]
break;
case 'debugEventFromParent':
event = eventFront + [value: sendValue, descriptionText: "-> ${sendValue}", isStateChange: true, displayed: true]
break;
// These are ones we don't need to display or provide descriptionText for (mostly internal or debug use)
case 'debugLevel':
case 'heatRangeLow':
case 'heatRangeHigh':
case 'coolRangeLow':
case 'coolRangeHigh':
case 'heatRange':
case 'coolRange':
case 'decimalPrecision':
// case 'timeOfDay':
case 'heatMode':
case 'coolMode':
case 'autoMode':
case 'auxHeatMode':
case 'currentProgramId':
case 'currentProgram':
case 'scheduledProgramName':
case 'scheduledProgramId':
case 'scheduledProgram':
case 'heatStages':
case 'coolStages':
case 'hasHeatPump':
case 'hasForcedAir':
case 'hasElectric':
case 'hasBoiler':
case 'auxHeatMode':
case 'heatDifferential':
case 'coolDifferential':
case 'programsList':
case 'holdEndsAt':
case 'temperatureScale':
if (isChange) event = eventFront + [value: sendValue, isStateChange: true, displayed: false]
break;
// everything else just gets displayed with generic text
default:
if (isChange) event = eventFront + [value: sendValue, descriptionText: "${name} is ${sendValue}", isStateChange: true, displayed: true]
break;
}
if (event != [:]) {
LOG("generateEvent() - Out of switch{}, calling sendevent(${event})", 5)
sendEvent(event)
}
if (tempDisplay != "") {
event = [ name: 'temperatureDisplay', value: tempDisplay, linkText: linkText, descriptionText:"Temperature Display is ${tempDisplay}", displayed: false ]
sendEvent(event)
LOG("generateEvent() - Temperature updated, calling sendevent(${event})", 5)
objectsUpdated++
}
}
generateSetpointEvent()
generateStatusEvent()
}
LOG("Updated ${objectsUpdated} object${objectsUpdated!=1?'s':''}",2,this,'info')
}
//return descriptionText to be shown on mobile activity feed
private getTemperatureDescriptionText(name, value, linkText) {
switch (name) {
case 'temperature':
return "Temperature is ${value}°"
break;
case 'heatingSetpoint':
return "Heating setpoint is ${value}°"
break;
case 'coolingSetpoint':
return "Cooling setpoint is ${value}°"
break;
case 'thermostatSetpoint':
return "Thermostat setpoint is ${value}°"
break;
case 'weatherTemperature':
return "Outside temperature is ${value}°"
break;
}
}
// Does not set in absolute values, sets in increments either up or down
def setTemperature(setpoint) {
LOG("setTemperature() called with setpoint ${setpoint}. Current temperature: ${device.currentValue("temperature")}. Heat Setpoint: ${device.currentValue("heatingSetpoint")}. Cool Setpoint: ${device.currentValue("coolingSetpoint")}. Thermo Setpoint: ${device.currentValue("thermostatSetpoint")}", 4)
def mode = device.currentValue("thermostatMode")
def midpoint
def targetvalue
if (mode == "off" || (mode == "auto" && !usingSmartAuto() )) {
LOG("setTemperature(): this mode: $mode does not allow raiseSetpoint", 2, null, "warn")
return
}
def currentTemp = device.currentValue("temperature")
def deltaTemp = 0
if (setpoint == 0) { // down arrow pressed
deltaTemp = -1
} else if (setpoint == 1) { // up arrow pressed
deltaTemp = 1
} else {
deltaTemp = ( (setpoint - currentTemp) < 0) ? -1 : 1
}
LOG("deltaTemp = ${deltaTemp}")
if (mode == "auto") {
// In Smart Auto Mode
LOG("setTemperature(): In Smart Auto Mode", 4)
if (deltaTemp < 0) {
// Decrement the temp for cooling
LOG("Smart Auto: lowerSetpoint being called", 4)
lowerSetpoint()
} else if (deltaTemp > 0) {
// Increment the temp for heating
LOG("Smart Auto: raiseSetpoint being called", 4)
raiseSetpoint()
} // Otherwise they are equal and the setpoint does not change
} else if (mode == "heat") {
// Change the heat
LOG("setTemperature(): change the heat temp", 4)
// setHeatingSetpoint(setpoint)
if (deltaTemp < 0) {
// Decrement the temp for cooling
LOG("Heat: lowerSetpoint being called", 4)
lowerSetpoint()
} else if (deltaTemp > 0) {
// Increment the temp for heating
LOG("Heat: raiseSetpoint being called", 4)
raiseSetpoint()
} // Otherwise they are equal and the setpoint does not change
} else if (mode == "cool") {
// Change the cool
LOG("setTemperature(): change the cool temp", 4)
// setCoolingSetpoint(setpoint)
if (deltaTemp < 0) {
// Decrement the temp for cooling
LOG("Cool: lowerSetpoint being called", 4)
lowerSetpoint()
} else if (deltaTemp > 0) {
// Increment the temp for heating
LOG("Cool: raiseSetpoint being called", 4)
raiseSetpoint()
} // Otherwise they are equal and the setpoint does not change
}
}
void setHeatingSetpoint(setpoint) {
LOG("setHeatingSetpoint() request with setpoint value = ${setpoint} before toDouble()", 4)
setHeatingSetpoint(setpoint.toDouble())
}
void setHeatingSetpoint(Double setpoint) {
// def mode = device.currentValue("thermostatMode")
LOG("setHeatingSetpoint() request with setpoint value = ${setpoint}", 4)
def heatingSetpoint = setpoint
def coolingSetpoint = device.currentValue("coolingSetpoint").toDouble()
def deviceId = getDeviceId()
LOG("setHeatingSetpoint() before compare: heatingSetpoint == ${heatingSetpoint} coolingSetpoint == ${coolingSetpoint}", 4)
//enforce limits of heatingSetpoint vs coolingSetpoint
def low = device.currentValue("heatRangeLow")
def high = device.currentValue("heatRangeHigh")
if (heatingSetpoint < low ) { heatingSetpoint = low }
if (heatingSetpoint > high) { heatingSetpoint = high}
if (heatingSetpoint > coolingSetpoint) {
coolingSetpoint = heatingSetpoint
}
LOG("Sending setHeatingSetpoint> coolingSetpoint: ${coolingSetpoint}, heatingSetpoint: ${heatingSetpoint}")
def sendHoldType = whatHoldType()
if (parent.setHold(this, heatingSetpoint, coolingSetpoint, deviceId, sendHoldType)) {
sendEvent("name":"heatingSetpoint", "value": wantMetric() ? heatingSetpoint : heatingSetpoint.toDouble().round(0).toInteger() )
sendEvent("name":"coolingSetpoint", "value": wantMetric() ? coolingSetpoint : coolingSetpoint.toDouble().round(0).toInteger() )
LOG("Done setHeatingSetpoint> coolingSetpoint: ${coolingSetpoint}, heatingSetpoint: ${heatingSetpoint}")
generateSetpointEvent()
generateStatusEvent()
} else {
LOG("Error setHeatingSetpoint(${setpoint})", 1, null, "error") //This error is handled by the connect app
}
}
void setCoolingSetpoint(setpoint) {
LOG("setCoolingSetpoint() request with setpoint value = ${setpoint} (before toDouble)", 4)
setCoolingSetpoint(setpoint.toDouble())
}
void setCoolingSetpoint(Double setpoint) {
LOG("setCoolingSetpoint() request with setpoint value = ${setpoint}", 4)
// def mode = device.currentValue("thermostatMode")
def heatingSetpoint = device.currentValue("heatingSetpoint").toDouble()
def coolingSetpoint = setpoint
def deviceId = getDeviceId()
LOG("setCoolingSetpoint() before compare: heatingSetpoint == ${heatingSetpoint} coolingSetpoint == ${coolingSetpoint}")
//enforce limits of heatingSetpoint vs coolingSetpoint
def low = device.currentValue("coolRangeLow")
def high = device.currentValue("coolRangeHigh")
if (coolingSetpoint < low ) { coolingSetpoint = low }
if (coolingSetpoint > high) { coolingSetpoint = high}
if (heatingSetpoint > coolingSetpoint) {
heatingSetpoint = coolingSetpoint
}