I am trying to develop an ios app using the newly published NEST api but bit lost with their native documentation.
Question:I could get an access token but do not know the thermostat endpoint to query and update "Away" state
Any pointers will be greatly appreciated ..
I'm presuming you intend to use REST to query and update the away state since you mentioned "endpoint"? If not the other alternative is to use the firebase API. This is documented in the introduction section
To get the away status you'll need to query the structure/s
curl -v -L https://developer-api.nest.com/structures?auth=<AUTH_TOKEN>
The response shows the away state in addition to the thermostats/smoke co alarms in that structure.
{
"g-9y-2xkHpBh1MGkVaqXOGJiKOB9MkoW1hhYyQk2vAunCK8a731jbg": {
"away": "home",
"country_code": "US",
"name": "Home",
"smoke_co_alarms": [
"0NBM7-QfoLwhMldZ2CoIkQ7hRJoe1Jye"
],
"structure_id": "g-9y-2xkHpBh1MGkVaqXOGJiKOB9MkoW1hhYyQk2vAunCK8a731jbg",
"thermostats": [
"GM6Z9JpSKU6_ua8AfD6WRA"
],
"time_zone": "America/Los_Angeles"
}
}
To update the away state you would need to use the PUT http verb:
curl -v -L -X PUT "https://developer-api.nest.com/structures/g-9y-2xkHpBh1MGkVaqXOGJiKOB9MkoW1hhYyQk2vAunCK8a731jbg?auth=<AUTH_TOKEN>" -H "Content-Type: application/json" -d '{"away":"away"}'
Note that the ID used in the path parameter is the structure ID returned in the get response.
Hope that helps Nagesh