# nest_set.py

Last modified by Richard Johnson on 2018/08/01 00:47
Export
Office Formats
Export as PDF
Other Formats

Select the pages to export:

select all/ none

Legend:
  Created Page
  Modified Extension Page
  Clean Extension Page

Export as HTML

    #! /usr/bin/env python

    import requests
    import sys

    my_token = 'my_nest_access_token'

    everything = requests.get('',
                 headers={'Authorization': 'Bearer ' + my_token, 'Content-Type': 'application/json'})

    for x in everything.json()['thermostats']:
      device_id = x
      break

    if sys.argv[1] == 'off':
      print 'off'
      cmd = 'off'
    elif sys.argv[1] == 'on':
      print 'on'
      cmd = 'heat-cool'

    set = requests.put('' +
          device_id +
          '?auth=my_nest_access_token',
          headers={'Authorization': 'Bearer ' + my_token, 'Content-type': 'application/json'},
                   data='{"hvac_mode": cmd}')

0
Tags:
Created by Richard Johnson on 2018/08/01 00:47

- Comments (0)
- Attachments (0)
- History
- Information

# Applications

# Tips

Did you know that you can improve XWiki? Take 5 minutes to fill this survey and help this open source project!

# Need help?

If you need help with XWiki you can contact:

- Community Support
- Professional Support

XWiki Debian 13.10.2