Skip to content

Commit

Permalink
Changed setClimate() so that any parameters can be set through a Map
Browse files Browse the repository at this point in the history
  • Loading branch information
yracine committed Apr 22, 2015
1 parent 34cd8e3 commit 420c239
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ecobee.devicetype.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -1944,10 +1944,10 @@ void iterateSetClimate(tstatType, climateName) {
// if no thermostatId is provided, it is defaulted to the current thermostatId
// The settings.thermostatId (input) is the default one
// climate name is the name of the climate to be set to (ex. "Home", "Away").
// holdType is the type of hold to be created,
// paramsMap: parameters Map, ex. [holdType:'nextTransition']
// see https://www.ecobee.com/home/developer/api/documentation/v1/functions/SetHold.shtml

void setClimate(thermostatId, climateName, holdType='') {
void setClimate(thermostatId, climateName, paramsMap=[]) {
def climateRef = null
def tstatParams

Expand All @@ -1971,14 +1971,13 @@ void setClimate(thermostatId, climateName, holdType='') {
continue
}

tstatParams =((holdType != null) && (holdType.trim() != "")) ?
[holdClimateRef:"${climateRef}", holdType:"${holdType}"] :
((settings.holdType != null) && (settings.holdType.trim() != "")) ?
tstatParams = ((settings.holdType != null) && (settings.holdType.trim() != "")) ?
[holdClimateRef:"${climateRef}", holdType:"${settings.holdType.trim()}"
] :
[holdClimateRef:"${climateRef}"
]

tstatParams = tstatParams + paramsMap
def bodyReq = build_body_request('setHold',null, data.thermostatList[i].identifier,tstatParams)
def statusCode=true
int j=0
Expand Down

0 comments on commit 420c239

Please sign in to comment.