Sign inSign up

derf/nest_poller

By derf

•Updated over 10 years ago

Docker Container to send Nest Data to InfluxDB

Image
2

636

derf/nest_poller repository overview

Based on https://github.com/grempe/nest_poller⁠

⁠Instructions for getting a long-life access token for API access

Guide: https://developer.nest.com/documentation/cloud/rest-quick-guide⁠

See : https://developer.nest.com/clients⁠ for my registered API clients and the URLs.

Step 1 : GET a PIN number

  • Replace STATE with a random number
  • Paste this in a BROWSER as you will have to click a button to authorize.
  • A PIN code will be returned which you will need for the next step.

GET https://home.nest.com/login/oauth2?client_id=3fb1f2d0-1f87-42f5-a9f8-0b21f142aef5&state=STATE⁠

Step 2 : Copy PIN code. e.g. N6B4FV9G

Step 3 : Exchange the authorization PIN code for a long-lived access token

Replace code=AUTHORIZATION_CODE in this URL with the PIN

POST https://api.home.nest.com/oauth2/access_token?client_id=3fb1f2d0-1f87-42f5-a9f8-0b21f142aef5&code=AUTHORIZATION_CODE&client_secret=D1AVcTSab5ERaolisto5uUDIc&grant_type=authorization_code⁠

Step 4 : Extract long-life access token from response which will be used for all future API requests.

{"access_token":"c.7MVm2...","expires_in":315360000}

⁠Run via Docker as:

docker run -e INFLUXDB_NEST_POLLER_HOST='10.7.0.80' -e INFLUXDB_NEST_POLLER_USERNAME='influxuser' -e INFLUXDB_NEST_POLLER_PASS='influxpass' -e NEST_API_ACCESS_TOKEN='c.7MVm2...' derf/nest_poller run

⁠Run via Docker Compose as:

nestpoller:
   environment:
      INFLUXDB_NEST_POLLER_HOST: influxdb
      INFLUXDB_NEST_POLLER_USERNAME: influxuser
      INFLUXDB_NEST_POLLER_PASS: influxpass
      NEST_API_ACCESS_TOKEN: c.7MVm2...
command:
      - run
image: derf/nest_poller
links:
       - influxdb:influxdb

influxdb:
  ports:
  - 8083:8083/tcp
  - 8086:8086/tcp
  - 8090:8090/tcp
  - 8099:8099/tcp
  environment:
    PRE_CREATE_DB: 'nest_poller'
 image: tutum/influxdb
 volumes:
  - /path/to/influxdb/data:/data

Tag summary

Content type

Image

Digest

Size

263.5 MB

Last updated

over 10 years ago

docker pull derf/nest_poller