a few more whitespace fixes

This commit is contained in:
Jim Anderson
2016-08-24 07:29:04 -05:00
parent e545842f7c
commit dbc2a1e45c

View File

@@ -294,10 +294,10 @@ Map sensorsDiscovered() {
} }
def getThermostatDisplayName(stat) { def getThermostatDisplayName(stat) {
if(stat?.name) { if(stat?.name) {
return stat.name.toString() return stat.name.toString()
} }
return (getThermostatTypeName(stat) + " (${stat.identifier})").toString() return (getThermostatTypeName(stat) + " (${stat.identifier})").toString()
} }
def getThermostatTypeName(stat) { def getThermostatTypeName(stat) {
@@ -384,8 +384,8 @@ def pollHandler() {
} }
def pollChildren(child = null) { def pollChildren(child = null) {
def thermostatIdsString = getChildDeviceIdsString() def thermostatIdsString = getChildDeviceIdsString()
log.debug "polling children: $thermostatIdsString" log.debug "polling children: $thermostatIdsString"
def requestBody = [ def requestBody = [
selection: [ selection: [
@@ -401,24 +401,24 @@ def pollChildren(child = null) {
def result = false def result = false
def pollParams = [ def pollParams = [
uri: apiEndpoint, uri: apiEndpoint,
path: "/1/thermostat", path: "/1/thermostat",
headers: ["Content-Type": "text/json", "Authorization": "Bearer ${atomicState.authToken}"], headers: ["Content-Type": "text/json", "Authorization": "Bearer ${atomicState.authToken}"],
// TODO - the query string below is not consistent with the Ecobee docs: // TODO - the query string below is not consistent with the Ecobee docs:
// https://www.ecobee.com/home/developer/api/documentation/v1/operations/get-thermostats.shtml // https://www.ecobee.com/home/developer/api/documentation/v1/operations/get-thermostats.shtml
query: [format: 'json', body: toJson(requestBody)] query: [format: 'json', body: toJson(requestBody)]
] ]
try{ try{
httpGet(pollParams) { resp -> httpGet(pollParams) { resp ->
if(resp.status == 200) { if(resp.status == 200) {
log.debug "poll results returned resp.data ${resp.data}" log.debug "poll results returned resp.data ${resp.data}"
atomicState.remoteSensors = resp.data.thermostatList.remoteSensors atomicState.remoteSensors = resp.data.thermostatList.remoteSensors
updateSensorData() updateSensorData()
storeThermostatData(resp.data.thermostatList) storeThermostatData(resp.data.thermostatList)
result = true result = true
log.debug "updated ${atomicState.thermostats?.size()} stats: ${atomicState.thermostats}" log.debug "updated ${atomicState.thermostats?.size()} stats: ${atomicState.thermostats}"
} }
} }
} catch (groovyx.net.http.HttpResponseException e) { } catch (groovyx.net.http.HttpResponseException e) {
log.trace "Exception polling children: " + e.response.data.status log.trace "Exception polling children: " + e.response.data.status
@@ -474,20 +474,20 @@ def availableModes(child) {
def modes = ["off"] def modes = ["off"]
if (tData.data.heatMode) { if (tData.data.heatMode) {
modes.add("heat") modes.add("heat")
} }
if (tData.data.coolMode) { if (tData.data.coolMode) {
modes.add("cool") modes.add("cool")
} }
if (tData.data.autoMode) { if (tData.data.autoMode) {
modes.add("auto") modes.add("auto")
} }
if (tData.data.auxHeatMode) { if (tData.data.auxHeatMode) {
modes.add("auxHeatOnly") modes.add("auxHeatOnly")
} }
return modes return modes
} }
def currentMode(child) { def currentMode(child) {
@@ -615,7 +615,7 @@ private void saveTokenAndResumeAction(json) {
atomicState.refreshToken = json?.refresh_token atomicState.refreshToken = json?.refresh_token
atomicState.authToken = json?.access_token atomicState.authToken = json?.access_token
if (atomicState.action) { if (atomicState.action) {
log.debug "ASYNC refreshTokenHandler: got refresh token, executing next action: ${atomicState.action}" log.debug "got refresh token, executing next action: ${atomicState.action}"
"${atomicState.action}"() "${atomicState.action}"()
} }
} else { } else {
@@ -678,7 +678,7 @@ boolean setHold(heating, cooling, deviceId, sendHoldType) {
] ]
] ]
return sendCommandToEcobee(payload) return sendCommandToEcobee(payload)
} }
/** /**
@@ -759,19 +759,19 @@ private boolean sendCommandToEcobee(Map bodyParams) {
] ]
try{ try{
httpPost(cmdParams) { resp -> httpPost(cmdParams) { resp ->
if(resp.status == 200) { if(resp.status == 200) {
log.debug "updated ${resp.data}" log.debug "updated ${resp.data}"
def returnStatus = resp.data.status.code def returnStatus = resp.data.status.code
if (returnStatus == 0) { if (returnStatus == 0) {
log.debug "Successful call to ecobee API." log.debug "Successful call to ecobee API."
isSuccess = true isSuccess = true
} else { } else {
log.debug "Error return code = ${returnStatus}" log.debug "Error return code = ${returnStatus}"
debugEvent("Error return code = ${returnStatus}") debugEvent("Error return code = ${returnStatus}")
} }
} }
} }
} catch (groovyx.net.http.HttpResponseException e) { } catch (groovyx.net.http.HttpResponseException e) {
log.trace "Exception Sending Json: " + e.response.data.status log.trace "Exception Sending Json: " + e.response.data.status
debugEvent ("sent Json & got http status ${e.statusCode} - ${e.response.data.status.code}") debugEvent ("sent Json & got http status ${e.statusCode} - ${e.response.data.status.code}")