Previous Example Next Example

Example 10: Deleting a vacation

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 delete a vacation from the thermostat, we use the function called DeleteVacation .

Note that vacation events cannot be removed with ResumeProgram .

To learn how to create a vacation go to our previous example.

If you want to learn more about how vacations are related to other events or objects of the thermostat, please refer to Example 5.

Create a json.txt file with the following JSON object. With this JSON, we will delete the vacation we created in the previous example.

{
  "selection": {
    "selectionType":"registered",
    "selectionMatch":""
  },
  "functions": [
    {
      "type":"deleteVacation",
      "params":{
        "name": "Skiing"
      }      
    }
  ]
}							
							

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 that our Skiing vacation has been deleted. 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\}\}'
							

As expected, the vacation is now gone, and only the default event exits.

	
																{
  "page": {
    "page": 1,
    "totalPages": 1,
    "pageSize": 1,
    "total": 1
  },
  "thermostatList": [
    {
      "identifier": "318324666667",
      "name": "Main Floor",
      "thermostatRev": "150213192706",
      "isRegistered": true,
      "modelNumber": "athenaSmart",
      "lastModified": "2015-02-13 19:27:06",
      "thermostatTime": "2015-02-13 14:27:21",
      "utcTime": "2015-02-13 19:27:21",
      "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": false,
          "isHeatOff": false,
          "coolHoldTemp": 780,
          "heatHoldTemp": 660,
          "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 our next example, we will learn how to change the program of the thermostat.

Previous Example Next Example