Skip to content

Instantly share code, notes, and snippets.

@tylerdave
Last active January 6, 2022 22:34
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tylerdave/409ffa08e1d47b1a1e23 to your computer and use it in GitHub Desktop.
Save tylerdave/409ffa08e1d47b1a1e23 to your computer and use it in GitHub Desktop.
Nest API Example
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chrisbsmith
Copy link

Thanks for the write up. This was exactly what I had been hunting for. One question, have you found a way to make the authorization_code be persistent? I can run the python code once per authorization_code. Second run I have get a new authorization code. This doesn't help with a cron'd script.

@anupama-kumar
Copy link

Hi !

The last line - print json.dumps(nest_response.json() ..
I don't see a device key, only structures and metadata -- have I made a mistake while registering the product?

Would be really thankful.

@technicalpickles
Copy link

This was really helpful, thanks!

I was trying to do this following https://developers.nest.com/documentation/cloud/rest-quick-guide which says to use the Authorization header with your access_token, and that was consistently failing with 401 Unauthorized. Using an auth param instead seems to work, but I haven't seen documentation for it (that doesn't say much though, the documentation is pretty scattered).

@technicalpickles
Copy link

Actually, I figured out why the authorization header wasn't working. Making requests to developer-api.nest.com ends up doing a redirect to a firebase hostname, and the requests library strips authorization headers when doing redirects. https://github.com/kennethreitz/requests/issues/2949 talks about this more, specifically about how it happens working with the Nest API.

@diegodeodati
Copy link

Hi, if i want to set temperature?

regards

@pratapkrish
Copy link

What programming language do I have to use in order to do this? I'm new to Nest development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment