So, My retrieving information on the thermostat is working fine, now I'm trying to update a setting on the ecobee and am receiving:
status.code=3
status.message="Update failed due to a communication error."
my query_string looks like:
{"selection":{"selectionType":"thermostats","selectionMatch":123456789,"thermostat":{"settings":{"humidity":45}}}}
My curl as follows:
-X POST https://api.ecobee.com/1/thermostat?format=json --data %7B%22selection%22%3A%7B%22selectionType%22%3A%22thermostats%22%2C%22selectionMatch%22%3A311081045454%2C%22thermostat%22%3A%7B%22settings%22%3A%7B%22humidity%22%3A45%7D%7D%7D%7D -H Content-Type: application/json;charset=UTF-8 -H Authorization: Bearer MY-ACCESS-TOKEN
--data - Ran the query-string through the jq '@URI' filter
also tried:
--data-urlencode -Without the '@URI' filter (this is the method shown by the Ecobee API Doc
Both ways return the "Update failed"
I do have working code from a project on GitHub written in python, but I'm using this as a bash/jq/API learning opportunity (also, I don't know python)
His code shows the following for updating a setting successfully:
url:1/thermostat
header:{'Content-Type': 'application/json;charset=UTF-8', 'Authorization': 'Bearer MY-ACCESS-TOKEN'}
parameters:{'format': 'json'}
body:{"thermostat": {"settings": {"humidity": 40}}, "selection": {"selectionType": "thermostats", "selectionMatch": "123456789"}}
{'status': {'code': 0, 'message': ''}}
This seems to match up to my curl request
This is what I'm using to build my curl (which should be maintaining the proper quoting):
url_request=(-X POST "https://api.ecobee.com/1/thermostat?format=json")
url_body=(--data "$query_string")
url_header=(-H "Content-Type: application/json;charset=UTF-8"
-H "Authorization: Bearer $access_token")
url+=("${url_request[@]}" "${url_body[@]}" "${url_header[@]}")
thermostat=$(curl -s "${url[@]}")
Anyone see anything obvious?
Thanks