-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathhoneywellhomedriver
287 lines (242 loc) · 8.75 KB
/
honeywellhomedriver
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
/*
Hubitat Driver For Honeywell Thermistate
Copyright 2020 - Taylor Brown
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Major Releases:
11-25-2020 : Initial
11-27-2020 : Alpha Release (0.1)
12-15-2020 : Beta 1 Release (0.2.0)
lgk 12-24-2020 add lastUpdated and humidity
lgk 10/24 new attributes
*/
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
metadata {
definition (
name: "Honeywell Home Thermostat",
description:"Driver for Lyric (LCC) and T series (TCC) Honeywell Thermostats, Requires corisponding Honeywell Home App.",
importUrl:"https://raw.githubusercontent.com/thecloudtaylor/hubitat-honeywell/main/honeywellhomedriver.groovy",
namespace: "thecloudtaylor",
author: "Taylor Brown") {
capability "Actuator"
capability "Temperature Measurement"
capability "Relative Humidity Measurement"
capability "Thermostat"
capability "Refresh"
//Maybe?
capability "Sensor"
attribute "thermostatFanState", "enum", ["true", "false"]
// lgk new attributes
attribute "fanOperatingState", "enum", ["on", "off"]
attribute "macID", "String"
attribute "maxCoolSetPoint", "Number"
attribute "minCoolSetPoint", "Number"
attribute "maxHeatSetPoint", "Number"
attribute "minHeatSetPoint", "Number"
attribute "vacationHold", "enum", ["true", "false"]
attribute "deviceName", "String"
attribute "isAlive", "enum", ["true", "false"]
attribute "model", "String"
// lgk end new attributes
attribute "emergencyHeatActive", "enum", [null, "true", "false"]
attribute "autoChangeoverActive", "enum", ["unsupported", "true", "false"]
attribute "allowedModes", "enum", ["EmergencyHeat", "Heat", "Off", "Cool","Auto"]
attribute "units", "enum", ["F", "C"]
attribute "lastUpdate", "string"
}
preferences{
input ("heatModeEnabled", "bool",
title: "Allow Heat Mode, if false heat mode will be iqnored",
defaultValue:true)
input ("coolModeEnabled", "bool",
title: "Allow Cool Mode, if false heat mode will be iqnored",
defaultValue:true)
input ("debugLogs", "bool",
title: "Enable debug logging",
defaultValue: false)
input ("descriptionText", "bool",
title: "Enable description text logging",
defaultValue: true)
}
}
void LogDebug(logMessage)
{
if(debugLogs)
{
log.debug "${device.displayName} ${logMessage}";
}
}
void LogInfo(logMessage)
{
log.info "${device.displayName} ${logMessage}";
}
void LogWarn(logMessage)
{
log.warn "${device.displayName} ${logMessage}";
}
void disableDebugLog()
{
LogWarn("Disabling Debug Logging.");
device.updateSetting("debugLogs",[value:"false",type:"bool"]);
}
void installed()
{
LogInfo("Installing.");
heatModeEnabled = true
coolModeEnabled = true
debugLogs = false
descriptionText = true
refresh()
}
void uninstalled()
{
LogInfo("Uninstalling.");
}
void updated()
{
LogInfo("Updating.");
refresh()
}
void parse(String message)
{
LogDebug("ParseCalled: ${message}");
}
void auto()
{
LogDebug("auto called");
if(device.currentValue("allowedModes").contains("Auto"))
{
setThermostatMode("auto")
}
else
{
LogWarn("Auto not in the supported modes.")
}
}
void cool()
{
LogDebug("cool called");
setThermostatMode("cool")
}
void emergencyHeat()
{
LogDebug("emergencyHeat called");
LogWarn("EmergancyHeat Not Supported")
}
void fanAuto()
{
LogDebug("fanAuto called");
setThermostatFanMode("auto")
}
void fanCirculate()
{
LogDebug("fanCirculate called");
setThermostatFanMode("circulate")
}
void fanOn()
{
LogDebug("fanOn called");
setThermostatFanMode("on")
}
void heat()
{
LogDebug("heat called");
setThermostatMode("heat")
}
void off()
{
LogDebug("off called");
setThermostatMode("off")
}
//Defined Command : temperature required (NUMBER) - Cooling setpoint in degrees
void setCoolingSetpoint(temperature)
{
LogDebug("setCoolingSetpoint() - autoChangeoverActive: ${device.currentValue("autoChangeoverActive")}");
//setThermosatSetPoint(com.hubitat.app.DeviceWrapper device, mode=null, autoChangeoverActive=false, heatPoint=null, coolPoint=null)
if (!parent.setThermosatSetPoint(device, null, device.currentValue("autoChangeoverActive"), device.currentValue("emergencyHeatActive"), null, temperature))
{
LogWarn("Set cooling point failed, attempting a refresh and re-try.")
parent.refreshThermosat(device)
parent.setThermosatSetPoint(device, null, device.currentValue("autoChangeoverActive"), device.currentValue("emergencyHeatActive"), null, temperature)
}
else
{
LogInfo("Cooling setpoint changed to ${temperature}")
}
}
//Defined Command : temperature required (NUMBER) - Heating setpoint in degrees
void setHeatingSetpoint(temperature)
{
LogDebug("setHeatingSetpoint() - autoChangeoverActive: ${device.currentValue("autoChangeoverActive")}");
//setThermosatSetPoint(com.hubitat.app.DeviceWrapper device, mode=null, autoChangeoverActive=false, heatPoint=null, coolPoint=null)
if (!parent.setThermosatSetPoint(device, null, device.currentValue("autoChangeoverActive"), device.currentValue("emergencyHeatActive"), temperature, null))
{
LogWarn("Set heating point failed, attempting a refresh and re-try.")
parent.refreshThermosat(device)
parent.setThermosatSetPoint(device, null, device.currentValue("autoChangeoverActive"), device.currentValue("emergencyHeatActive"), temperature, null)
}
else
{
LogInfo("Heating setpoint changed to ${temperature}")
}
}
//Defined Command : JSON_OBJECT (JSON_OBJECT) - JSON_OBJECT
void setSchedule(JSON_OBJECT)
{
LogDebug("setSchedule called");
}
//Defined Command : fanmode required (ENUM) - Fan mode to set
void setThermostatFanMode(fanmode)
{
LogDebug("setThermostatFanMode called");
if(device.currentValue("supportedThermostatFanModes").contains(fanmode))
{
if(!parent.setThermosatFan(device, fanmode))
{
LogWarn("Set fan mode failed, attempting a refresh and re-try.")
parent.refreshThermosat(device)
parent.setThermosatFan(device, fanmode);
}
else
{
LogInfo("Fan Mode Chanaged to: ${fanmode}")
}
}
else
{
LogWarn("${fanmode} not in the supported fan modes.")
}
}
//Defined Command : thermostatmode required (ENUM) - Thermostat mode to set
void setThermostatMode(thermostatmode)
{
LogDebug("setThermostatMode() - autoChangeoverActive: ${device.currentValue("autoChangeoverActive")}");
if (thermostatmode == "heat" && !heatModeEnabled)
{
LogInfo("Heating Mode Requested but Not Allowed, Iqnoring")
return
}
if (thermostatmode == "cool" && !coolModeEnabled)
{
LogInfo("Cooling Mode Requested but Not Allowed, Iqnoring")
return
}
//setThermosatSetPoint(com.hubitat.app.DeviceWrapper device, mode=null, autoChangeoverActive=false, heatPoint=null, coolPoint=null)
if (!parent.setThermosatSetPoint(device, thermostatmode, device.currentValue("autoChangeoverActive"), device.currentValue("emergencyHeatActive"), null, null))
{
LogWarn("Set point failed, attempting a refresh and re-try.")
parent.refreshThermosat(device)
parent.setThermosatSetPoint(device, thermostatmode, device.currentValue("autoChangeoverActive"), device.currentValue("emergencyHeatActive"), null, null);
}
else
{
LogInfo("mode changed to ${thermostatmode}")
}
}
void refresh()
{
LogDebug("Refresh called");
parent.refreshThermosat(device)
}