I think they just broke them again
I just noticed a ton of login errors in my logs and found this when I checked:
Just added this again .. not used for awhile ..
Seems to be work great now Wohooo! ![]()
Using : csteele: v1.3.21 < on a Honeywell TH9320WF5003 WIFI
I made a few changes to this one I am using ..
I and AI added HTTP time out to the driver ..
and did some logging changes for fun ..


/**
* IMPORT URL: https://raw.githubusercontent.com/HubitatCommunity/HoneywellThermo-TCC/master/HoneywellThermo-TCC_C.groovy
*
* Total Comfort API
*
* Based on Code by Eric Thomas, Edited by Bob Jase, and C Steele
*
* 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
* for the specific language governing permissions and limitations under the License.
*
*
*
* csteele: v1.3.21 Added "accumulation" feature to setStatus.
* login returns true/false allowing get/setStatus to retry login
* csteele: v1.3.20 Added "emergency/auxiliary" heat.
* added fanOperatingState Attribute.
* csteele: v1.3.19 FollowSchedule typo.
* csteele: v1.3.18 FollowSchedule enhanced.
* added HoldTime and TemporaryHoldUntilTime into data storage.
* added isScheduleCapable to FollowSchedule check.
* lgk: v1.3.17 initialize device.data.unit
* tinfoil: v1.3.16 fix to heatLevelUp/Down commands
* lgk: v1.3.15 add retries after unauthorized and read failures.
* add html query and parsing to get whole house/steam humidifier info and put in attributes.
* changed tcc line.
* modified again by lgkahn 11/20 first the heating cooling was not working right.
* changed back to using equipment status.. just because the fan is on does not mean it is heating..
* fan is also used for humidication or just by itself.
*
* jvm: v1.3.14 fix to address "componentRefresh()" error in logs.
* csteele: v1.3.13 added Initialize per ryanmellish suggestion to jumpstart polling after hub power cycle.
* jvm: v1.3.12 Enabled Humidity child device.
* csteele: v1.3.11 refactored support for lastRunningMode as data vs attribute
* csteele: v1.3.10 add support for lastRunningMode which directly follows thermostatMode
* refactored 'switch/case' code into a Map for fan and operating state
* nvious1: v1.3.9 adding "fan only" operating mode for when the equipment is off but the fan is running. Added 3 min polling option.
* csteele: v1.3.8 made "description logging is" optional and info
* added explicit check for cooling in getStatusHandler
* csteele: v1.3.7 removed state.displayunits as unused. Everything has already been using the Hub's location.temperatureScale,
* which meant that installed() was redundant too.
* jvm : v1.3.6 added range checking for changes to heating and cooling setpoints.
* Outdoor thermostate creates as a child device.
* Fixed bugs in use of tccSite variable.
* csteele: corrected sendEvent("humidity")
* corrected operating state to track EquipmentOutputStatus
* refactored cool/heat up/down
* jvm: limit checked temperature set points
* csteele: v1.3.5 added "%" to humidity and centralized temp scale
* jvm: v1.3.4 added "°F" or "°C" unit to temp and setpoint events. Fixed thermostateMode being set to a temperature value.
* csteele: v1.3.2 centralized Honeywell site url as "tccSite"
* csteele: v1.3.1 updated to v2 of updateCheck
* csteele: v1.3.0 converted to asynchttp where possible.
* csteele: v1.2.3 communications with TCC changed and now Mode and Fan need to be numbers
* Operating State reflects the ENUM values ("Unknown" isn't acceptable)
* csteele: v1.2.2 replaced F/C selection with value from Location in the hub.
* csteele: v1.2 option of polling interval, off through 60 min. added descTextEnable for Description logging.
* csteele: v1.1.5 allow option of permanent or temporary hold.
* csteele: v1.1 merged Pull Request from rylatorr: Use permanent hold instead of temporary
* csteele: v1.0 added Cobra's Version Check code, modified debug logging to match Hubitat standards, (on/off and 30 min limit)
* removed Relative Humidity and SmartThings "main" paragraph
*
* (Bob) version 10 deals with the fact that Honeywell decided to poison the well with expired cookies
* I also changed it so that it polls for an update every 60 seconds
* lgk version 9 an indicator on the bottom which indicates if following schedule or vacation or temp hold.
* it also displays green for following schedule and red for other modes.
* you can also select it to cancel a hold and go back to following schedule.
* however, the temp will not update till next refresh even though you have cancelled the hold.
* One problem, is that the colors are not working correctly in ios currently and the label is not
* wrapping in android as it is supposed to.
* lgk version 8 figured out how to do time without user input of time zone offset.. and this works with and without
* daylight saving time.
* lgk version 7, change the new operating state to be a value vs standard tile
* to work around a bug smartthings caused in the latest 2.08 release with text wrapping.
* related also added icons to the operating state, and increase the width of the last update
* to avoid wrapping.
* lgk version 6 add support for actually knowing the fan is on or not (added tile),
* and also the actual operating state ie heating,cooling or idle via new response variables.
* lgk version 5, due to intermittant update failures added last update date/time tile so that you can see when it happended
* not there is a new input tzoffset which defaults to my time ie -5 which you must set .
* lgk version 4 supports celsius and fahrenheit with option, and now colors.
* lgk v 3 added optional outdoor temp sensors and preferences for it, also made api login required.
*
*/
public static String version() { return "v1.3.21" }
public static String tccSite() { return "mytotalconnectcomfort.com" }
metadata {
definition (name: "HONEYWELL TOTAL COMFORT - WW & AI VERSION", namespace: "csteele", author: "Eric Thomas, lg kahn, C Steele", importUrl: "https://raw.githubusercontent.com/HubitatCommunity/HoneywellThermo-TCC/master/HoneywellThermo-TCC_C.groovy") {
capability "Polling"
capability "Thermostat"
capability "Refresh"
capability "Temperature Measurement"
capability "Sensor"
capability "Relative Humidity Measurement"
capability "Initialize"
command "heatLevelUp"
command "heatLevelDown"
command "coolLevelUp"
command "coolLevelDown"
command "setFollowSchedule"
attribute "outdoorHumidity", "number"
attribute "outdoorTemperature", "number"
attribute "lastUpdate", "string"
attribute "followSchedule", "string"
attribute "fanOperatingState", "string"
attribute "humidifierStatus", "string"
attribute "humidifierSetPoint", "number"
attribute "humidifierUpperLimit", "number"
attribute "humidifierLowerLimit", "number"
}
preferences {
input name: "username", type: "text", title: "Username", description: "Your Total Comfort User Name", required: true
input name: "password", type: "password", title: "Password", description: "Your Total Comfort password", required: true
input name: "honeywelldevice", type: "text", title: "Device ID", description: "Your Device ID", required: true
input name: "haveHumidifier", type: "enum", title: "Do you have an optional whole house steam humidifier and want to enable it?", options: ["Yes", "No"], required: true, defaultValue: "No"
input name: "enableOutdoorTemps", type: "enum", title: "Do you have the optional outdoor temperature sensor and want to enable it?", options: ["Yes", "No"], required: false, defaultValue: "No"
input name: "enableHumidity", type: "enum", title: "Do you have the optional Humidity sensor and want to enable it?", options: ["Yes", "No"], required: false, defaultValue: "No"
input name: "setPermHold", type: "enum", title: "Will Setpoints be temporary or permanent?", options: ["Temporary", "Permanent"], required: false, defaultValue: "Temporary"
input name: "pollIntervals", type: "enum", title: "Set the Poll Interval.", options: [0:"off", 60:"1 minute", 120:"2 minutes", 180:"3 minutes", 300:"5 minutes",600:"10 minutes",900:"15 minutes",1800:"30 minutes",3600:"60 minutes"], required: true, defaultValue: "600"
input name: "httpTimeout", type: "number", title: "HTTP Timeout (seconds)", description: "Timeout for HTTP requests (seconds)", required: true, defaultValue: 15 // Added for timeout preference
input name: "debugOutput", type: "bool", title: "Enable debug logging?", defaultValue: true
input name: "descTextEnable", type: "bool", title: "Enable descriptionText logging", defaultValue: true
}
}
// parse events into attributes
def parse(String description) {
}
// handle commands
def coolLevelUp() { if (location.temperatureScale == "F") { setCoolingSetpoint(device.currentValue("coolingSetpoint") + 1) } else { setCoolingSetpoint( (Double) device.currentValue("coolingSetpoint") + 0.5) }}
def coolLevelDown() { if (location.temperatureScale == "F") { setCoolingSetpoint(device.currentValue("coolingSetpoint") - 1) } else { setCoolingSetpoint( (Double) device.currentValue("coolingSetpoint") - 0.5) }}
def heatLevelUp() { if (location.temperatureScale == "F") { setHeatingSetpoint(device.currentValue("heatingSetpoint") + 1) } else { setHeatingSetpoint( (Double) device.currentValue("heatingSetpoint") + 0.5) }}
def heatLevelDown() { if (location.temperatureScale == "F") { setHeatingSetpoint(device.currentValue("heatingSetpoint") - 1) } else { setHeatingSetpoint( (Double) device.currentValue("heatingSetpoint") - 0.5) }}
def setCoolingSetpoint(temp) {
float valIn = temp // for limits check
temp = ensureRange( temp.toFloat(), state.coolLowerSetptLimit.toFloat(), state.coolUpperSetptLimit.toFloat() )
if (valIn != temp) log.warn "-= SetPoint limited due to: out of range"
deviceDataInit(state.PermHold) // reset all params, then set individually
state.deviceSetting.CoolSetpoint = temp
log.warn "-= Setting cool setpoint to: ${temp}"
setStatus()
if(device.data.SetStatus==1)
{
sendEvent(name: 'coolingSetpoint', value: temp as Integer, unit:"°${location.temperatureScale}")
}
}
def setCoolingSetpoint(double temp) {
double valIn = temp // for limits check
temp = ensureRange( temp.toFloat(), state.coolLowerSetptLimit.toFloat(), state.coolUpperSetptLimit.toFloat() )
if (valIn != temp) log.warn "-= SetPoint limited due to: out of range"
deviceDataInit(state.PermHold) // reset all params, then set individually
state.deviceSetting.CoolSetpoint = temp
log.warn "-= Setting cool set point down to: ${temp}"
setStatus()
if(device.data.SetStatus==1)
{
sendEvent(name: 'coolingSetpoint', value: temp as double, unit:"°${location.temperatureScale}")
}
}
def setHeatingSetpoint(temp) {
float valIn = temp // for limits check
temp = ensureRange( temp.toFloat(), state.heatLowerSetptLimit.toFloat(), state.heatUpperSetptLimit.toFloat() )
if (valIn != temp) log.warn "-= SetPoint limited due to: out of range"
deviceDataInit(state.PermHold) // reset all params, then set individually
state.deviceSetting.HeatSetpoint = temp
log.warn "-= Setting heat setpoint to: ${temp}"
setStatus()
if(device.data.SetStatus==1)
{
sendEvent(name: 'heatingSetpoint', value: temp as Integer, unit:"°${location.temperatureScale}")
}
}
def setHeatingSetpoint(Double temp) {
double valIn = temp // for limits check
temp = ensureRange( temp.toFloat(), state.heatLowerSetptLimit.toFloat(), state.heatUpperSetptLimit.toFloat() )
if (valIn != temp) log.warn "-= SetPoint limited due to: out of range"
deviceDataInit(state.PermHold) // reset all params, then set individually
state.deviceSetting.HeatSetpoint = temp
log.warn "-= Setting heat set point down to: ${temp}"
setStatus()
if(device.data.SetStatus==1)
{
sendEvent(name: 'heatingSetpoint', value: temp as double, unit:"°${location.temperatureScale}")
}
}
def setFollowSchedule() {
if (debugOutput) log.debug "in set follow schedule"
deviceDataInit(0) // reset all params, then set individually
setStatus()
if(device.data.SetStatus==1)
{
if (debugOutput) log.debug "-= Successfully sent follow schedule.!"
}
}
def off() {
setThermostatMode('off')
}
def auto() {
setThermostatMode('auto')
}
def heat() {
setThermostatMode('heat')
}
def cool() {
setThermostatMode('cool')
}
def emergencyHeat() {
if (isEmergencyHeatAllowed) {
if (debugOutput) log.warn "-= Set Emergency/Auxiliary Heat On =-"
setThermostatMode('emergency heat')
}
}
def setThermostatMode(mode) {
Map modeMap = [auto:5, cool:3, heat:1, off:2, 'emergency heat':4]
if (debugOutput) log.warn "-= Setting Thermostat Mode: $mode"
state.deviceSetting.SystemSwitch = modeMap.find{ mode == it.key }?.value
setStatus()
if(device.data.SetStatus==1)
{
sendEvent(name: 'thermostatMode', value: mode)
lrM(mode)
}
}
def fanOn() {
setThermostatFanMode('on')
}
def fanAuto() {
setThermostatFanMode('auto')
}
def fanCirculate() {
setThermostatFanMode('circulate')
}
def setThermostatFanMode(mode) {
Map fanMap = [auto:0, on:1, circulate:2, followSchedule:3]
if (debugOutput) log.warn "-= Setting Thermostat Fan Mode: $mode"
def fanMode = null
state.deviceSetting.FanMode = fanMap.find{ mode == it.key }?.value
setStatus()
if(device.data.SetStatus==1)
{
sendEvent(name: 'thermostatFanMode', value: mode)
}
}
void setStatus() {
runInMillis( 1600, settingsAccumWait )
}
void settingsAccumWait() {
device.data.SetStatus = 0
if ( !login() ) {
pauseExecution(6000)
if ( !login() ) {
return
}
}
if (debugOutput) log.debug "Honeywell TCC 'setStatus'"
def today = new Date()
def params = [
uri: "https://${tccSite()}/portal/Device/SubmitControlScreenChanges",
headers: [
'Accept': 'application/json, text/javascript, */*; q=0.01',
'DNT': '1',
'Accept-Encoding': 'gzip,deflate,sdch',
'Cache-Control': 'max-age=0',
'Accept-Language': 'en-US,en,q=0.8',
'Connection': 'keep-alive',
'Host': "${tccSite()}",
'Referer': "https://${tccSite()}/portal/Device/Control/${settings.honeywelldevice}",
'X-Requested-With': 'XMLHttpRequest',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36',
'Cookie': device.data.cookiess
],
body: [
DeviceID: "${settings.honeywelldevice}",
SystemSwitch: state.deviceSetting.SystemSwitch,
HeatSetpoint: state.deviceSetting.HeatSetpoint,
CoolSetpoint: state.deviceSetting.CoolSetpoint,
HeatNextPeriod: state.deviceSetting.HeatNextPeriod,
CoolNextPeriod: state.deviceSetting.CoolNextPeriod,
StatusHeat: state.deviceSetting.StatusHeat,
StatusCool: state.deviceSetting.StatusCool,
fanMode: state.deviceSetting.FanMode,
DisplayUnits: location.temperatureScale,
TemporaryHoldUntilTime: state.deviceSetting.TemporaryHoldUntilTime,
VacationHold: state.deviceSetting.VacationHold
],
timeout: settings.httpTimeout ?: 15 // Modified for timeout preference
]
if (debugOutput) log.debug "params = $params"
try {
httpPost(params) {
resp ->
def setStatusResult = resp.data
if (debugOutput) log.warn "-= Thermostat Request was successful, $resp.status"
device.data.SetStatus = 1
}
}
catch (e) {
log.error "-= Something went wrong: $e"
}
// prepare for the next cycle by clearing all the values just sent.
deviceDataInit(null)
}
def setStatusHandler(resp, data) {
if(resp.getStatus() == 408) {if (debugOutput) log.debug "-= TCC Request Timed Out, $resp.status"}
if(resp.getStatus() == 200 || resp.getStatus() == 207) {
def setStatusResult = resp.data
if (debugOutput) log.warn "-= Thermostat Request was Successful, $resp.status"
device.data.SetStatus = 1
} else { if (descTextEnable) log.warn "-= TCC Set Status Failed" }
}
def getStatus(Boolean fromUnauth = false) {
if (debugOutput) log.warn "-= Honeywell TCC Get Status"
if (debugOutput) log.warn "-= Enable Outside Temps = $enableOutdoorTemps"
def today = new Date()
def params = [
uri: "https://${tccSite()}/portal/Device/CheckDataSession/${settings.honeywelldevice}",
headers: [
'Accept': '*/*',
'DNT': '1',
'Cache': 'false',
'dataType': 'json',
'Accept-Encoding': 'plain',
'Cache-Control': 'max-age=0',
'Accept-Language': 'en-US,en,q=0.8',
'Connection': 'keep-alive',
'Referer': "https://${tccSite()}/portal",
'X-Requested-With': 'XMLHttpRequest',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36',
'Cookie': device.data.cookiess
],
timeout: settings.httpTimeout ?: 15 // Modified for timeout preference
]
if (debugOutput) log.debug "sending getStatus request"
state.fromUnauth = fromUnauth
asynchttpGet("getStatusHandler", params)
}
def getStatusHandler(resp, data) {
if (resp.getStatus() == 200 || resp.getStatus() == 207) {
if (debugOutput) log.info "status = ${resp.getStatus()}"
if (debugOutput) log.info "data = ${resp.data}"
try {
if (resp.data) {
def setStatusResult = parseJson(resp.data)
if (debugOutput) {
log.warn "-= Request was successful, $resp.status"
log.debug "data = $setStatusResult"
log.debug "ld = $setStatusResult.latestData.uiData"
log.debug "ld = $setStatusResult.latestData.fanData"
}
sendEvent(name: 'supportedThermostatFanModes', value: ["\"auto\"", "\"circulate\"", "\"on\""] )
def curTemp = setStatusResult.latestData.uiData.DispTemperature.toDouble().round(2)
def switchPos = setStatusResult.latestData.uiData.SystemSwitchPosition
def coolSetPoint = setStatusResult.latestData.uiData.CoolSetpoint
def heatSetPoint = setStatusResult.latestData.uiData.HeatSetpoint
def statusCool = setStatusResult.latestData.uiData.StatusCool
def statusHeat = setStatusResult.latestData.uiData.StatusHeat
def Boolean hasIndoorHumid= setStatusResult.latestData.uiData.IndoorHumiditySensorAvailable
def curHumidity = setStatusResult.latestData.uiData.IndoorHumidity
def Boolean hasOutdoorHumid = setStatusResult.latestData.uiData.OutdoorHumidityAvailable
def Boolean hasOutdoorTemp = setStatusResult.latestData.uiData.OutdoorTemperatureAvailable
def Boolean isScheduleCapable = setStatusResult.latestData.uiData.ScheduleCapable
def curOutdoorHumidity = setStatusResult.latestData.uiData.OutdoorHumidity.toDouble().round(2)
def curOutdoorTemp = setStatusResult.latestData.uiData.OutdoorTemperature.toDouble().round(2)
def equipmentStatus = setStatusResult.latestData.uiData.EquipmentOutputStatus
def holdTime = setStatusResult.latestData.uiData.TemporaryHoldUntilTime
def vacationHoldMode = setStatusResult.latestData.uiData.IsInVacationHoldMode
def vacationHold = setStatusResult.latestData.uiData.VacationHold
def Boolean isEmergencyHeatAllowed = setStatusResult.latestData.uiData.SwitchEmergencyHeatAllowed
state.heatLowerSetptLimit = setStatusResult.latestData.uiData.HeatLowerSetptLimit
state.heatUpperSetptLimit = setStatusResult.latestData.uiData.HeatUpperSetptLimit
state.coolLowerSetptLimit = setStatusResult.latestData.uiData.CoolLowerSetptLimit
state.coolUpperSetptLimit = setStatusResult.latestData.uiData.CoolUpperSetptLimit
if (isEmergencyHeatAllowed)
sendEvent(name: 'supportedThermostatModes', value: ["\"auto\"", "\"cool\"", "\"emergency heat\"", "\"heat\"", "\"off\""] )
else
sendEvent(name: 'supportedThermostatModes', value: ["\"auto\"", "\"cool\"", "\"heat\"", "\"off\""] )
def fanMode = setStatusResult.latestData.fanData.fanMode
def fanIsRunning = setStatusResult.latestData.fanData.fanIsRunning
logInfo "got temp = $curTemp"
logInfo "got humidity = $curHumidity"
if (debugOutput) log.debug "got holdTime = $holdTime"
if (debugOutput) log.debug "got Vacation Hold = $vacationHoldMode"
if (debugOutput) log.debug "got scheduleCapable = $isScheduleCapable"
if (debugOutput) log.debug "got Emergency Heat = $isEmergencyHeatAllowed"
if (holdTime != 0) {
if (debugOutput) log.debug "sending temporary hold"
sendEvent(name: 'followSchedule', value: "TemporaryHold")
}
if (vacationHoldMode == true) {
if (debugOutput) log.debug "sending vacation hold"
sendEvent(name: 'followSchedule', value: "VacationHold")
}
if (vacationHoldMode == false && holdTime == 0 && isScheduleCapable == true ) {
if (debugOutput) log.debug "Sending following schedule"
sendEvent(name: 'followSchedule', value: "FollowingSchedule")
}
if (hasIndoorHumid == false) { curHumidity = 0 }
// Operating State Section
def fanState = "idle"
if (fanIsRunning) {
fanState = "on";
}
def operatingState = [ 0: 'idle', 1: 'heating', 2: 'cooling' ][equipmentStatus] ?: 'idle'
if ((haveHumidifier != 'Yes') && (fanIsRunning == true) && (equipmentStatus == 0)) {
operatingState = "fan only"
} else if ((haveHumidifier == 'Yes') && (fanIsRunning == true) && (equipmentStatus == 0) && (fanMode == 0)) {
operatingState = "Humidifying"
}
logInfo("Get Operating State: $operatingState - Fan to $fanState, switchPos = $switchPos")
log.warn "-= GETTING HONEYWELL THERMOSTAT INFO =-"
n = [ 0: 'auto', 2: 'circulate', 1: 'on', 3: 'followSchedule' ][fanMode]
sendEvent(name: 'thermostatFanMode', value: n)
if (isEmergencyHeatAllowed) n = [ 1: 'heat', 2: 'off', 3: 'cool', 4: 'emergency heat', 5: 'auto'][switchPos] ?: 'auto'
else n = [ 1: 'heat', 2: 'off', 3: 'cool', 4: 'auto'][switchPos] ?: 'auto'
sendEvent(name: 'temperature', value: curTemp, state: n, unit:"°${location.temperatureScale}")
sendEvent(name: 'thermostatMode', value: n)
lrM(n)
// Send events
sendEvent(name: 'thermostatOperatingState', value: operatingState)
sendEvent(name: 'fanOperatingState', value: fanState)
sendEvent(name: 'coolingSetpoint', value: coolSetPoint, unit:"°${location.temperatureScale}")
sendEvent(name: 'heatingSetpoint', value: heatSetPoint, unit:"°${location.temperatureScale}")
sendEvent(name: 'humidity', value: curHumidity as Integer, unit:"%")
if (haveHumidifier == 'Yes') {
log.debug "fanIsRunning = $fanIsRunning, equip status = $equipmentStatus, fanMode = $fanMode, temp = $curTemp, humidity = $curHumidity"
if ((fanIsRunning == true) && (equipmentStatus == 0) && (fanMode == 0)) {
log.debug "Humidifier is On"
sendEvent(name: 'humidifierStatus', value: "Humidifying")
} else {
log.debug "Humidifier is Off"
sendEvent(name: 'humidifierStatus', value: "Idle")
}
} else {
sendEvent(name: "humidifierStatus", value: "N/A")
}
def now = new Date().format('MM/dd/yyyy h:mm a', location.timeZone)
sendEvent(name: "lastUpdate", value: now, descriptionText: "Last Update: $now")
if (enableOutdoorTemps == "Yes") {
if (hasOutdoorHumid) {
setOutdoorHumidity(curOutdoorHumidity)
sendEvent(name: 'outdoorHumidity', value: curOutdoorHumidity as Integer, unit:"%")
}
if (hasOutdoorTemp) {
setOutdoorTemperature(curOutdoorTemp)
sendEvent(name: 'outdoorTemperature', value: curOutdoorTemp as Integer, unit:"°${location.temperatureScale}")
}
}
} else {
log.warn "No data returned status = ${resp.getStatus()}"
log.warn "Scheduling a retry in 5 minutes due to failure!"
runIn(300,"refreshFromRunin")
}
} catch (groovy.json.JsonException e) {
log.warn "in error handler case resp = $resp error = $e"
if (state.fromUnauth) {
log.debug "2nd failure ... giving up!"
} else {
log.warn "First failure, Trying again in 60 seconds.!"
runIn(60,"refreshFromRunin")
}
}
} else {
if (descTextEnable) log.info "TCC getStatus failed"
}
}
def getHumidifierStatus(Boolean fromUnauth = false) {
if (debugOutput) log.debug "in get humid status enable humidifier = $haveHumidifier"
if (settings.haveHumidifier == 'No') return
def params = [
uri: "https://${tccSite()}/portal/Device/Menu/${settings.honeywelldevice}",
headers: [
'Accept': '*/*',
'DNT': '1',
'dataType': 'json',
'cache': 'false',
'Accept-Encoding': 'plain',
'Cache-Control': 'max-age=0',
'Accept-Language': 'en-US,en,q=0.8',
'Connection': 'keep-alive',
'Host': 'rs.alarmnet.com',
'Referer': 'https://${tccSite()}/portal/',
'X-Requested-With': 'XMLHttpRequest',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36',
'Cookie': device.data.cookiess
],
timeout: settings.httpTimeout ?: 15 // Modified for timeout preference
]
if (debugOutput) log.debug "sending gethumidStatus request: $params"
def CancelLine = [:]
def Number HumLevel
def Number HumMin
def Number HumMax
try {
httpGet(params) { response ->
if (debugOutput) log.debug "GetHumidity Request was successful, $response.status"
if (debugOutput) log.debug "response = $response.data"
def data = response.getData().toString()
data.split("\n").each {
if (it.contains("CancelMin")) {
CancelLine = it.trim()
def pair = CancelLine.split(" ");
if (debugOutput) log.debug "got cancel min line: $CancelLine"
def p0 = pair[0]
def p1 = pair[1]
def p2 = pair[2]
def pair2 = p1.split("%")
def p20 = pair2[0]
def p21 = pair2[2]
def p22 = pair2[2]
HumLevel = p21.toInteger()
HumMin = p20.toInteger()
def pair3 = p2.split("%")
def p30 = pair3[0]
HumMax = p30.toInteger()
if (debugOutput) log.debug "-----------------------"
log.debug "Got current humidifier level = $HumLevel"
log.debug "Got Current humidifier Min = $HumMin"
log.debug "Got Current humidifier Max= $HumMax"
}
}
sendEvent(name: 'humidifierSetPoint', value: HumLevel as Integer, unit:"%")
sendEvent(name: 'humidifierUpperLimit', value: HumMax as Integer, unit:"%")
sendEvent(name: 'humidifierLowerLimit', value: HumMin as Integer, unit:"%")
}
}
catch (e) {
log.error "Something went wrong (getHumidifierStatus): $e"
def String eStr = e.toString()
def pair = eStr.split(" ")
def p1 = pair[0]
def p2 = pair[1]
if ((p2 == "Unauthorized") || (p2 == "Read")) {
if (fromUnauth) {
log.debug "2nd Unauthorized failure ... giving up!"
} else {
log.debug "Scheduling a retry in 5 minutes due to Unauthorized!"
runIn(300,"refreshFromRunin")
}
}
}
}
// Update lastRunningMode based on mode and operatingstate
def lrM(mode) {
String lrm = getDataValue("lastRunningMode")
if (mode.contains("auto") || mode.contains("off") && lrm != "heat") { updateDataValue("lastRunningMode", "heat") }
else { updateDataValue("lastRunningMode", mode) }
}
def api(method, args = [], success = {}) {}
def deviceDataInit(val) { // reset all params, then set individually
if ( !state.deviceSetting?.size) {
state.deviceSetting = [:]
state.deviceSetting << [SystemSwitch: null, StatusHeat: null, StatusCool: null, HeatSetpoint: null, CoolSetpoint: null, HeatNextPeriod: null, CoolNextPeriod: null, FanMode: null, TemporaryHoldUntilTime: null, VacationHold: null]
}
state.deviceSetting.StatusHeat=val
state.deviceSetting.StatusCool=val
if ( val == null ) {
state.deviceSetting.SystemSwitch = null
state.deviceSetting.HeatSetpoint = null
state.deviceSetting.CoolSetpoint = null
state.deviceSetting.HeatNextPeriod = null
state.deviceSetting.CoolNextPeriod = null
state.deviceSetting.FanMode = null
state.deviceSetting.TemporaryHoldUntilTime=null
state.deviceSetting.VacationHold=null
}
}
float ensureRange(float value, float min, float max) {
return Math.min(Math.max(value, min), max);
}
def refreshFromRunin() {
log.debug "Calling refresh after Unauthorize failure!"
refresh(true)
}
void componentRefresh(cd) {
if (debugOutput) log.debug "Refresh request from device ${cd.displayName}. This will refresh all component devices."
getStatus(false)
}
def refresh(Boolean fromUnauth = false) {
if (debugOutput) log.debug "here Honeywell TCC 'refresh', pollInterval: $pollInterval, units: = °${location.temperatureScale}, fromUnauth = $fromUnauth"
if ( !login() ) {
pauseExecution(6000)
if ( !login() ) {
return
}
}
getHumidifierStatus(fromUnauth)
getStatus(fromUnauth)
}
def login(Boolean fromUnauth = false) {
if (debugOutput) log.debug "Honeywell TCC 'login'"
Boolean ofExit = true // default: assume that login works and return a True.
Map params = [
uri: "https://${tccSite()}/portal/",
headers: [
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json, text/javascript, */*; q=0.01',
'Accept-Encoding': 'sdch',
'Host': "${tccSite()}",
'DNT': '1',
'Origin': "https://${tccSite()}/portal/",
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36'
],
body: [timeOffset: '240', UserName: "${settings.username}", Password: "${settings.password}", RememberMe: 'false'],
timeout: settings.httpTimeout ?: 15 // Modified for timeout preference
]
device.data.cookiess = ''
try {
httpPost(params) {
response ->
if (debugOutput) log.debug "Request was successful, $response.status"
String allCookies = ""
response.getHeaders('Set-Cookie').each {
String cookie = it.value.split(';|,')[0]
Boolean skipCookie = false
def expireParts = it.value.split('expires=')
try {
def cookieSegments = it.value.split(';')
for (int i = 0; i < cookieSegments.length; i++) {
def cookieSegment = cookieSegments[i]
String cookieSegmentName = cookieSegment.split('=')[0]
if (cookieSegmentName.trim() == "expires") {
String expiration = cookieSegment.split('=')[1]
Date expires = new Date(expiration)
Date newDate = new Date()
if (expires < newDate) {
skipCookie = true
}
}
}
} catch (e) {
if (debugOutput) log.debug "!error when checking expiration date: $e ($expiration) [$expireParts.length] {$it.value}"
}
allCookies = allCookies + it.value + ';'
if (cookie != ".ASPXAUTH_TH_A=") {
if (it.value.split('=')[1].trim() != "") {
if (!skipCookie) {
if (debugOutput) log.debug "Adding cookie to collection: $cookie"
device.data.cookiess += cookie + ';'
}
}
}
}
int cookieCount = device.data.cookiess.split(";", -1).length - 1;
if (cookieCount < 8) {
ofExit = false
}
}
} catch (e) {
log.warn "Something went wrong during login: $e"
def String eStr = e.toString()
def pair = eStr.split(" ")
def p1 = pair[0]
def p2 = pair[1]
if ((p2 == "Unauthorized") || (p2 == "Read")) {
if (fromUnauth) {
log.debug "2nd Unauthorized failure ... giving up!"
} else {
log.debug "Scheduling a retry in 30 minutes due to Unauthorized!"
runIn(1800,"refreshFromRunin")
}
}
ofExit = false
}
return ofExit
}
def initialize() {
logInfo "Initialize Poll"
state.deviceSetting = [:]
state.deviceSetting << [SystemSwitch: null, StatusHeat: null, StatusCool: null, HeatSetpoint: null, CoolSetpoint: null, HeatNextPeriod: null, CoolNextPeriod: null, FanMode: null, TemporaryHoldUntilTime: null, VacationHold: null]
poll()
}
def poll() {
pollInterval = pollIntervals.toInteger()
if (pollInterval) runIn(pollInterval, poll)
log.warn "-= GETTING HONEYWELL THERMOSTAT INFO =-"
logInfo "in poll: (every $pollInterval seconds)"
refresh()
}
def updated() {
if (debugOutput) log.debug "in updated"
// Added for input validation
def valid = true
if (!settings.username?.trim()) {
log.warn "Username is empty or not set. Please provide a valid Total Comfort username."
valid = false
}
if (!settings.password?.trim()) {
log.warn "Password is empty or not set. Please provide a valid Total Comfort password."
valid = false
}
if (!settings.honeywelldevice?.trim() || !settings.honeywelldevice.isNumber()) {
log.warn "Device ID is empty or not a valid number. Please provide a valid Honeywell Device ID."
valid = false
}
if (!valid) {
log.warn "Preference validation failed. Disabling polling to prevent API errors."
unschedule(poll) // Stop polling if validation fails
return
}
// End input validation
pollInterval = pollIntervals.toInteger()
if (debugOutput) log.debug "debug logging is: ${debugOutput == true}"
if (descTextEnable) log.info "description logging is: ${descTextEnable == true}"
unschedule()
dbCleanUp()
if (setPermHold == "Permanent") { state.PermHold = 2 } else { state.PermHold = 1 }
if (debugOutput) log.debug "PermHold now = ${state.PermHold}"
poll()
}
def logsOff(){
if (descTextEnable) log.warn "debug logging disabled..."
device.updateSetting("debugOutput",[value:"false",type:"bool"])
}
private logInfo(msg) {
if (settings?.descTextEnable || settings?.descTextEnable == null) log.info "$msg"
}
private dbCleanUp() {
state.remove("tempOffset")
state.remove("version")
state.remove("Version")
state.remove("sensorTemp")
state.remove("author")
state.remove("Copyright")
state.remove("verUpdate")
state.remove("verStatus")
state.remove("Type")
state.remove("DisplayUnits")
device.data.remove("SystemSwitch")
device.data.remove("VacationHold")
device.data.remove("HeatNextPeriod")
device.data.remove("HeatSetpoint")
device.data.remove("CoolSetpoint")
device.data.remove("TemporaryHoldUntilTime")
device.data.remove("CoolNextPeriod")
device.data.remove("FanMode")
device.data.remove("StatusHeat")
device.data.remove("StatusCool")
}
void setOutdoorTemperature(value){
def cd = getChildDevice("${device.id}-Temperature Sensor")
if (!cd) {
cd = addChildDevice("hubitat", "Generic Component Temperature Sensor", "${device.id}-Temperature Sensor", [name: "Outdoor Temperature", isComponent: true])
}
String unit = "°${location.temperatureScale}"
cd.parse([[name:"temperature", value:value, descriptionText:"${cd.displayName} is ${value}${unit}.", unit: unit]])
}
void setOutdoorHumidity(value){
def cd = getChildDevice("${device.id}-Humidity Sensor")
if (!cd) {
cd = addChildDevice("hubitat", "Generic Component Humidity Sensor", "${device.id}-Humidity Sensor", [name: "Outdoor Humidity", isComponent: true])
}
cd.parse([[name:"humidity", value:value, descriptionText:"${cd.displayName} is ${value}%.", unit:"%"]])
}
def getThisCopyright(){"© 2020 C Steele "}
RTH9585WF – Emergency Heat not working (SystemSwitch=4 vs 0, wrong mode mapping, isEmergencyHeatAllowed guard)
I am using the above referenced thermostat and I could not switch it to Emergency Heat mode from Hubitat. After some digging and small modifications to the driver, I was able to get it working just fine. I hope this helps anyone else having similar issues or leads to change to the code to support my specific thermostat.
Bug report
Environment
- Thermostat: Honeywell RTH9585WF (Wi-Fi, TCC)
- Integration: Honeywell Thermo Parent / Honeywell WiFi Thermostat Component drivers
- Platform: Hubitat Elevation (current firmware as of Dec 2025)
Summary
Emergency Heat mode on my RTH9585WF could not be controlled from Hubitat using the Honeywell TCC parent/child drivers, even though:
- The TCC mobile app and web portal can successfully switch to Emergency Heat.
- Heat / Cool / Off do work from Hubitat.
After some digging, this appears to be a combination of:
- The driver using SystemSwitch = 4 for
"emergency heat", while my RTH9585WF / TCC backend actually uses SystemSwitch = 0 for Emergency Heat. - The inbound
switchPos → thermostatModemapping not handling0and defaulting to"auto". componentEmergencyHeat(cd)being gated by anisEmergencyHeatAllowedvariable that is never actually wired up to the value parsed ingetStatusDistrib.- This thermostat doesn't have a full auto mode, so if the SystemSwitch values for other thermostats differ, that could explain it.
Steps to reproduce
- Configure RTH9585WF with the TCC / Honeywell Thermo Parent + Honeywell WiFi Thermostat Component drivers.
- From the child thermostat device in Hubitat, try:
- Command:
Emergency Heat - or Command:
Set Thermostat Mode→emergency heat.
- Observe:
- Hubitat logs show
setStatuscalls, but - The thermostat mode does not change to Emergency Heat.
- From the TCC mobile app:
- Tap Emergency Heat on the same thermostat.
- The thermostat immediately enters Emergency Heat.
Observed behavior (before changes)
- From Hubitat:
- Heat / Cool / Off worked as expected.
- Emergency Heat commands did not change the thermostat.
- In logs, using the unmodified driver:
- For Emergency Heat, the driver built a
setStatusrequest with:
- For Emergency Heat, the driver built a
body: [SystemSwitch:4, DeviceID:7464659, DisplayUnits:F]
- But the thermostat did not switch to EM.
- Inbound status mapping:
- When the thermostat was in Emergency Heat (set from app), the driver reported:
thermostatMode: auto
instead ofemergency heat.
- When the thermostat was in Emergency Heat (set from app), the driver reported:
What the TCC app actually sends
Using HTTPS sniffing of the TCC web/app traffic, the payload for Emergency Heat on my device looks like:
{
DeviceID: 7464659,
SystemSwitch: 0,
HeatSetpoint: null,
CoolSetpoint: null,
HeatNextPeriod: null,
CoolNextPeriod: null,
StatusHeat: null,
StatusCool: null,
FanMode: null
}
So for this RTH9585WF on TCC:
SystemSwitch: 0= Emergency Heat
The driver, however, had:
@Field static Map modeMap = [auto:5, cool:3, heat:1, off:2, 'emergency heat':4]
and in getStatusDistrib:
n = [ 1: 'heat', 2: 'off', 3: 'cool', 5: 'auto', 4: 'emergency heat' ][switchPos] ?: 'auto'
So:
- Outbound EM =
4(ignored by TCC for this device). - Inbound EM (
switchPos = 0) = falls through tonulland defaults to"auto".
isEmergencyHeatAllowed guard issue
There also appears to be a mismatch in how isEmergencyHeatAllowed is used:
- In
getStatusDistrib:
Boolean isEmergencyHeatAllowed = decodedResult.latestData.uiData.SwitchEmergencyHeatAllowed
That Boolean is local to the method and not stored.
- In
componentEmergencyHeat(cd):
void componentEmergencyHeat(cd) {
if (descTextEnable) log.info "received Emergency Heat request from ${cd.displayName}"
if (isEmergencyHeatAllowed) {
if (debugOutput) log.debug "Set Emergency/Auxiliary Heat On"
setThermostatMode(cd, 'emergency heat')
}
}
Here isEmergencyHeatAllowed is referenced as if it’s a class or state variable, but it’s never set there. In practice, this if short-circuits and EM is never even attempted.
I temporarily patched componentEmergencyHeat to ignore isEmergencyHeatAllowed and always call setThermostatMode(... 'emergency heat') so I could test the SystemSwitch mapping.
Temporary fixes I applied (and which made EM work)
- Fix outbound mapping for EM:
@Field static Map modeMap = [auto:5, cool:3, heat:1, off:2, 'emergency heat':0]
- **Fix inbound mapping for EM:**In
getStatusDistrib, change:
n = [ 1: 'heat', 2: 'off', 3: 'cool', 5: 'auto', 4: 'emergency heat' ][switchPos] ?: 'auto'
to:
n = [
1: 'heat',
2: 'off',
3: 'cool',
5: 'auto',
0: 'emergency heat', // my RTH9585WF / TCC reports EM as 0
4: 'emergency heat' // keep for devices that use 4
][switchPos] ?: 'auto'
- Bypass the broken
isEmergencyHeatAllowedguard incomponentEmergencyHeat(cd):
void componentEmergencyHeat(cd) {
if (descTextEnable) log.info "received Emergency Heat request from ${cd.displayName}"
log.info "FORCING Emergency/Auxiliary Heat ON for ${cd.displayName} (isEmergencyHeatAllowed=${isEmergencyHeatAllowed})"
setThermostatMode(cd, 'emergency heat')
}
After these changes:
Emergency Heatcommand from the child device:- Sends
SystemSwitch:0to TCC, - Thermostat goes into Emergency Heat,
- Inbound status reports
thermostatMode: emergency heatcorrectly.
- Sends
Suggested fixes / enhancements
- Emergency Heat mapping
- Consider allowing
SystemSwitch:0as EM for devices that reportSwitchEmergencyHeatAllowed = trueand use 0 in their control calls, while still supporting4for older/other models. - The dual mapping
0: 'emergency heat', 4: 'emergency heat'ingetStatusDistribseems safe.
isEmergencyHeatAllowedwiring
- Persist the value of
SwitchEmergencyHeatAllowed(e.g. per-child instate), and reference that incomponentEmergencyHeat(cd), or - Drop the guard and trust
supportedThermostatModesand/or the TCC response if EM is listed there, or - At minimum, ensure
isEmergencyHeatAllowedincomponentEmergencyHeatis the same property that gets set during status parsing.
- Make EM behavior device-aware
- The sniffed payload for my RTH9585WF shows EM as
SystemSwitch:0with most other fieldsnull. Other models might still use4. - A small bit of logic based on
uiData.SwitchEmergencyHeatAllowedand the values seen inlatestData.uiData.SystemSwitchPositionmight allow the driver to choose0 vs 4per device and keep things compatible for other thermostats.
If it would help, I can provide:
- Full before/after debug logs for:
- Heat / Cool commands from Hubitat
- Emergency Heat from Hubitat (with both
SystemSwitch:4andSystemSwitch:0) - Emergency Heat from the TCC app/web,
- Plus any additional headers/body details you’d like to see from the app capture.
I had the same issue. Thanks for posting your findings. The line numbers have changed a little over time but searching for emergency heat will turn up the lines to edit.
@csteele thanks for this driver! If you continue to update it it would be cool to let us configure this mapping. My thermostat is the “VisionPRO8000” with manufacturer part number TH8320R1003.
For anyone else setting up that kind of thermostat with the redlink gateway, this video is helpful:
Released v2.0.18 (Parent) and v2.0.8 (child)![]()
v2.0.18 Added preference for EmergencyHeat to use either 0 or 4 to support more thermostat models
isEmergencyHeatAllowed added to state. per bdunbar analysis
The Child now has:
default is “Four” for backwards compatibility.
I do NOT have a Thermostat that supports any flavor of Emergency Heat. I can only say that I tried to implement @bdunbar suggestion. You’ll let me know, I’m sure… ![]()
Thanks for adding that preference!
I set it to Zero for my thermostat, but the Device Current States list still shows Thermostat Mode as “emergency heat” instead of “auto.” (I rebooted and tried setting Thermostat Mode with the menu in the child device, too.)
I updated via HMP and verified that I have the current versions by checking the code.
Anything I can do to help troubleshoot the display?
I guess the ‘patch’ offered by @bdunbar didn’t cover the display side of the project.
The Interface with Honeywell is just two paths… get status and set parameters.
To understand what you’re seeing, can you tell me if the Emergency Heat actually works?? You select the “Zero” option and then tap Emergency Heat… does it come on? In other words is it a [set parameter] problem or a [get status] (aka display) problem, please?
As far as I can tell it is a display problem. My thermostat on the wall and the Honeywell app show my thermostat is on “auto” while the Hubitat device page shows “emergency heat.”
Unfortunately, it’s not possible for me to test every input, because my own system doesn’t even support “emergency heat.” I had to look that up, it’s apparently a special mode where if your heat pump is broken, it falls back to gas/electric heat. I only have gas heat and my own thermostat does not let me set Emergency Heat mode as it’s not applicable to my system. I suppose the installer configured the thermostat accordingly when the system went in.
@csteele - Thanks for this fantastic driver. I see one issue I would like to run by you. My Thermostat can be put into ‘Permanent Hold’, however the driver does not seem to want to recognize that and always shows ‘FollowingSchedule’ even when I have put it into ‘Permanent Hold’ at the thermostat:
Is there something I am missing here on why it would show ‘followingschedule’ even when it is not?
It’s possible that the Driver isn’t interpreting a change made on the Thermostat itself, manually. In other words the Thermostat sends something but the driver isn’t seeing it the way it expects to see it spelt, for example. “PermanentHold” vs “permHold”.
But I must point out that the driver currently requires a choice between Temporary Hold vs Permanent Hold:
The first is a ‘display’ item related to what the driver receives.
The second is related to what’s being sent to Honeywell and thus to the Thermostat.
Can you clarify, please?
I confirmed that the driver is working as designed if changing the temp from Hubitat : If I set the preference to have the setpoints to be temporary it keeps any temp change I send to it on the schedule and if I set the preference to have the setpoints to be permanent, any temp change puts it on permanent hold.
Also re-confirmed a change to permanent hold from the thermostat itself does not change the ‘ Follow Schedule’ state to ‘PermanentHold’ if the preference is set to have the setpoints be temporary.
The temporary vs permanent hold on temp change is more of a use case issue for me. My preference is that it would a Command vs a Preference. Just like Heat vs Cool, Fan On vs Fan Auto etc. Reason being is that this is a vacation home. When I am there, I want temp changes I make in Hubitat to not affect the schedule, as I want the temp changes to be temporary. But when I leave for weeks on end, I want any temp change to be permanent. So it depends on the use case so having it as a Command would be better for my use case.
Thanks for clarifying how it the App is set up to work. Not asking to change anything as it will probably mess up other peoples use case ![]()
You’re describing a use case that I had not encountered before. ![]()
I use my Thermostat with Schedules and it’s the schedule that has the Set Points (heat or cool). I have certainly used a temporary hold over the years, which reverts to Follow Schedule. I’ve never considered using a Permanent Hold. I have long wondered why there’s a Permanent Hold feature, when its functionality is simply to not revert to Follow Schedule. Why not just change the schedule, is the thought that flew through my mind. “Vacation home” certainly changes that for me. ![]()
Thanks, that did clarify.
Yup. When you are not in a home for weeks at a time permanent hold is an important function!





