NOTE: This is not an official Google product.
This is a simple web app that talks to the Works with Nest API using Python and
the Flask web framework. You'll use a Nest product to be accessed from the app.
—————————————————————————————————————
- The sample code
- Basic knowledge of HTML, CSS, Javascript, and Python (to change the sample)
- Python interpreter 2.7.x
- At least one Nest device, such as Nest Thermostat, Nest Cam, or Nest Protect
—————————————————————————————————————
This project uses Python's PIP to manage dependent packages.
- Install PIP and Python 2.7:
https://zaiste.net/posts/installing_python_27_on_osx_with_homebrew/
- Download the sample app and install the dependencies.
In a terminal window, go to the python-sample directory and run the following commands.
Spin up a virtual environment:
$ pip install virtualenv
$ virtualenv env
$ . env/bin/activate
Install the dependencies (virtualenv):
(env) $ pip install -r requirements.txt
—————————————————————————————————————
If you don't already have a Nest device set up and associated with your
home.nest.com account, use one of the following procedures.
Set up a Nest device with a Mac or Windows computer
-OR-
Set up a Nest device with the Nest App
-OR-
Use the Nest Home Simulator to simulate a Nest device
—————————————————————————————————————
Use the same account that you used for your Nest device.
For the redirect URI, use http://localhost:5000/callback
For the permissions, select read/write corresponding with your Nest product. For
example,
if your Nest product is a Thermostat, select Thermostat Read/Write.
In order to authorize your Nest integration, you need a Product ID and Product
Secret. The next step is to set the product ID and product secret as environment
variables so these values can be retrieved by the application.
If you are using Linux or MacOS, open a Bash shell and type the commands below
(substitute your product ID and secret you copied from your product page):
$ export PRODUCT_ID = 'Your product ID here'
$ export PRODUCT_SECRET = 'Your product secret here'
—————————————————————————————————————
If it's not already running, spin up the virtual environment:
$ virtualenv env
$ . env/bin/activate
Run app.py:
$ python app.py
If you are prompted, click to allow incoming network connections.
—————————————————————————————————————
7. Open http://localhost:5000/
Click Login.
When we log in, we are redirected to the Nest Authorization screen.
On the Nest Authorization screen, click Accept.
When we accept the integration, the Nest Authorization screen redirects to the
Redirect URL configured for our product integration
(http://localhost:5000/callback).
—————————————————————————————————————
In Chrome, right-click the app and select Inspect.
In the Responsive pulldown menu, select another format, such as iPhone 6.
Click the icon that looks like a phone (Toggle device toolbar).
10 Tips for a successful Nest integration
Contributions are always welcome and highly encouraged.
See CONTRIBUTING for more information on how to get started.
Apache 2.0 - See LICENSE for more information.