ahmednuaman / rpi-nest-radiator-switch

A nodejs project to get a Raspberry PI to control a towel radiator using the Nest API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rpi-nest-radiator-switch

A nodejs project to get a Raspberry PI to control a towel radiator using the Nest API

Setting up the hardware parts

You'll need:

This is my hardware set up:

I use PINs 12 (BCM 18), 1 (5V), and 14 (Ground) to connect to the relay (you're able to change this in the code). Here's a handy chart: https://pinout.xyz/

Getting your auth settings

This project uses the config.json to hold your access token. Thankfully Nest uses non-expiring tokens so to get your access token simply follow these steps:

  1. Do everything as root (I know, I know)
  2. Open /etc/rc.local and add svscan /service & before exit 0
  3. Make a folder /service
  4. cd into /service and clone the repo, this'll create a folder within called rpi-nest-radiator-switch
  5. cd into the repo folder, run chmod +x run
  6. Register a new Nest project for yourself: https://developers.nest.com/products
  7. Create a whack 'Redirect URI'
  8. Take note of the Product ID and Product Secret and hit the Authorization URL
  9. Take note of the code in the URL once you've authed
  10. Make the CURL request displayed here: https://developers.nest.com/documentation/cloud/sample-code-auth
  11. Copy and paste the response into config.json (it ought to look like { "access_token": "xxx", "expires_in": 315360000 })
  12. Don't forget to set your target_thermostat too, this is the ID (key) under devices > thermostats object: https://developers.nest.com/documentation/api-reference

About

A nodejs project to get a Raspberry PI to control a towel radiator using the Nest API

License:MIT License


Languages

Language:JavaScript 97.9%Language:Shell 2.1%