Acquiring and changing basic data on the Nest thermostat

孤者浪人 提交于 2019-12-18 04:14:27

问题


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?


回答1:


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.




来源:https://stackoverflow.com/questions/24601798/acquiring-and-changing-basic-data-on-the-nest-thermostat

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!