Previous Example Next Example

Example 6: Resuming a thermostat's program

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 tell the thermostat that we want to resume its Program, we have to use another function called ResumeProgram .

Create a file called json.txt. The file should contain the following contents. The ResumeProgram function has an optional parameter, resumeAll. This is normally false, which the thermostat will resume to the next event on the event stack. If this value is true, then it will attempt to resume to its original program.

Note that vacation events and mandatory events cannot be resumed, you must delete the vacation event using the DeleteVacation function, and allow the mandatory events to run its course.

{
  "selection": {
    "selectionType":"registered",
    "selectionMatch":""
  },
  "functions": [
    {
      "type":"resumeProgram",
      "params":{
        "resumeAll":false
      }      
    }
  ]
}							
							

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": ""
  }
}							
							

Let us verify that the thermostat has removed the hold. We use the GET Thermostat request and set the includeEvents property.

curl -s -H 'Content-Type: text/json' -H 'Authorization: Bearer ACCESS_TOKEN' 'https://api.ecobee.com/1/thermostat?format=json&body=\{"selection":\{"selectionType":"registered","selectionMatch":"","includeEvents":true\}\}'
							

The previous hold has been removed, and only the _Default_ event is in place.

{
  "page": {
    "page": 1,
    "totalPages": 1,
    "pageSize": 1,
    "total": 1
  },
  "thermostatList": [
    {
      "identifier": "318324702718",
      "name": "Main Floor",
      "thermostatRev": "150213165057",
      "isRegistered": true,
      "modelNumber": "athenaSmart",
      "lastModified": "2015-02-13 16:50:57",
      "thermostatTime": "2015-02-13 11:52:23",
      "utcTime": "2015-02-13 16:52:23",
      "events": [
        {
          "type": "template",
          "name": "_Default_",
          "running": false,
          "startDate": "2035-01-01",
          "startTime": "00:00:00",
          "endDate": "2035-01-01",
          "endTime": "23:59:59",
          "isOccupied": false,
          "isCoolOff": true,
          "isHeatOff": false,
          "coolHoldTemp": 828,
          "heatHoldTemp": 568,
          "fan": "auto",
          "vent": "off",
          "ventilatorMinOnTime": 5,
          "isOptional": true,
          "isTemperatureRelative": false,
          "coolRelativeTemp": 40,
          "heatRelativeTemp": 40,
          "isTemperatureAbsolute": false,
          "dutyCyclePercentage": 255,
          "fanMinOnTime": 0,
          "occupiedSensorActive": false,
          "unoccupiedSensorActive": false,
          "drRampUpTemp": 0,
          "drRampUpTime": 3600,
          "linkRef": "",
          "holdClimateRef": ""
        }
      ]
    }
  ],
  "status": {
    "code": 0,
    "message": ""
  }
}							
							

In the next example, we will learn how to change the mode of the fan.

Previous Example Next Example