Previous Example Next Example

Example 7: Temporarily changing the fan mode

Note on token authentication:

If you have completed the authentication process from Example 1, your access token will be pre-populated in all requests throughout every example.

To specify a different access token, please paste it in the form below and press 'Update'. Alternatively, you can go back to the first example here to re-authenticate. Doing either will save your access token for all future examples.

Access Token:


To change the fan mode, it is similar to creating a temporary temperature hold in Example 5.

Create a json.txt file with the following JSON object. With this JSON, we will create a hold that will set the fan mode to on.

Note that it is good practice to obtain the current hold temperatures either by previously querying the events or runtime of the Thermostat. Please refer to this example to see how you can obtain the runtime properties of the thermostat, and take a look at this example to see how to retrieve events from the thermostat.

{
  "selection": {
    "selectionType":"registered",
    "selectionMatch":""
  },
  "functions": [
    {
      "type":"setHold",
      "params":{
        "holdType":"nextTransition",
        "heatHoldTemp":707,
        "coolHoldTemp":717,
        "fan": "on"
      }
    }
  ]
}							
							

Post our function using cURL.

curl -s --request POST --data-urlencode @json.txt -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: Bearer ACCESS_TOKEN" "https://api.ecobee.com/1/thermostat?format=json"							
							

If the post is successful, you should see this.

{
  "status": {
    "code": 0,
    "message": ""
  }
}							
							

Use the ResumeProgram function in this example to cancel the fan mode.

In the next example, we will learn how to change the mode of the thermostat to off and then to heat.

Previous Example Next Example