7

I've been having trouble acquiring and changing some of the basic data available from the Nest thermostat.

Using a command line, how can I get or change individual settings or values on my thermostat?

jfudgeelder
  • 423
  • 3
  • 13
  • I know this isn't the basic premise of stackoverflow but the Nest API page routes users to this site. By adding a post like this, I'm hoping it helps other users who are confused. Is there any better way you suggest doing this? I'm completely new here. – jfudgeelder Jul 07 '14 at 17:37
  • You can change the question to be more on the lines of "How would Acquire and changing basic data on the Nest thermostat?" then put the information you've collected as the answer. – Noelkd Jul 07 '14 at 17:47
  • OK, I made some changes and switched everything around a bit. Hopefully it works well now. – jfudgeelder Jul 07 '14 at 19:23

1 Answers1

13

This is a compilation from several users explaining how to retrieve or change some basic information with some of my own experiences added in. Wherever I use <VALUE>, replace that with the applicable information in your setup. If you're using Windows, you'll need something like git-scm.

  • The following a part of the authentication process. You'll need to have a client already made on Nest's developer page and followed the provided authorization URL to get your auth code. Run this line to get an access token:

    curl --data 'code=<AUTH CODE>&client_id=<CLIENT ID>&client_secret=<CLIENT SECRET>&grant_type=authorization_code' https://api.home.nest.com/oauth2/access_token
    
  • To fetch some information about the thermostats associated with the authorization code:

    curl -v -L https://developer-api.nest.com/devices/thermostats?auth=<AUTH CODE>
    
  • To fetch some information about a specific thermostat:

    curl -v -L https://developer-api.nest.com/devices/thermostats/<THERMOSTAT ID>?auth=<AUTH CODE>
    
  • To fetch the target temperature in F from the specified thermostat. You can replace target_temperature_f with any other value listed under thermostat on Nest's API reference:

    curl -v -L https://developer-api.nest.com/devices/thermostats/<THERMOSTAT ID>/target_temperature_f?auth=<AUTH CODE>
    
  • To change the target_temperature_f:

    curl -v -L -X PUT "https://developer-api.nest.com/devices/thermostats/<THERMOSTAT ID>/target_temperature_f?auth=<AUTH CODE>" -H "Content-Type: application/json" -d "65"
    
  • To change the specific structure to away. The value here is a string so be sure to include the single quotes:

    curl -v -L -X PUT "https://developer-api.nest.com/structures/<STRUCTURE ID>/away?auth=<AUTH_TOKEN>" -H "Content-Type: application/json" -d '"away"'
    

Credit for this is primarily to the following users: thesimm, mccv, Nagesh Susarla, and David W. Keith.


Community
  • 1
  • 1
jfudgeelder
  • 423
  • 3
  • 13