|
1 |
| -========================================================= |
2 |
| -Python API and command line tool for the Nest™ Thermostat |
3 |
| -========================================================= |
| 1 | +# Python API and command line tool for the Nest™ Thermostat |
4 | 2 |
|
| 3 | +TODO: Fix build check |
5 | 4 | .. image:: https://travis-ci.org/jkoelker/python-nest.svg?branch=master
|
6 | 5 | :target: https://travis-ci.org/jkoelker/python-nest
|
7 | 6 |
|
| 7 | +**NOTE: This library support the new (post 2020) API provided by Google which replaced the original Nest Developers API.** |
8 | 8 |
|
9 |
| -Installation |
10 |
| -============ |
11 |
| - |
12 |
| -.. code-block:: bash |
13 |
| -
|
14 |
| - [sudo] pip install python-nest |
15 |
| -
|
16 |
| -
|
17 |
| -*NOTE* The ``4.x`` version uses the streaming endpoint. To use the older |
18 |
| -polling/caching behavior pin your requirements to ``python-nest<4.0``. |
19 |
| - |
20 |
| -*NOTE* The ``3.x`` version uses the Nest official api. As such, some functionality |
21 |
| -was removed as it is not available. To keep the old version and functionality, make sure to set |
22 |
| -your requirements to ``python-nest<3.0``. |
23 |
| - |
24 |
| -Nest Developer Account |
25 |
| -======================= |
| 9 | +## Installation |
26 | 10 |
|
| 11 | +```bash |
| 12 | + [sudo] pip install python-google-nest |
| 13 | +``` |
27 | 14 |
|
28 |
| -You will need a Nest developer account, and a Product on the Nest developer portal to use this module: |
| 15 | +## Google Device Access Registration |
29 | 16 |
|
30 |
| -1. Visit `Nest Developers <https://developers.nest.com/>`_, and sign in. Create an account if you don't have one already. |
| 17 | +This is a fairly onerous process, so make sure to read the details before you begin. |
31 | 18 |
|
32 |
| -2. Fill in the account details: |
| 19 | +The biggest roadblock is that access to this API requires registering with Google for Device Access <https://developers.google.com/nest/device-access/registration>. This has a one time $5 fee. |
33 | 20 |
|
34 |
| - - The "Company Information" can be anything. |
| 21 | +The documentation <https://developers.google.com/nest/device-access/get-started> walks you through the rest of the process. |
35 | 22 |
|
36 |
| -3. Submit changes. |
| 23 | +At a high level it involves: |
37 | 24 |
|
38 |
| -4. Click "`Products <https://developers.nest.com/products>`_" at top of page. |
| 25 | +1. Making sure your Nest devices are linked to your Google account |
| 26 | +2. Set up GCP (Google Cloud Platform) account <https://console.cloud.google.com/> |
| 27 | +3. Set up a new GCP project |
| 28 | + 1. Create a Oauth landing page and add your email as a test user |
| 29 | + 2. Enable the Smart device management API |
| 30 | + 3. Create an Oauth credential with the settings called from web server and https://www.google.com as the authorized redirect URI. Note the client ID and secret from this step. |
| 31 | +4. In https://console.nest.google.com/device-access create a new project and add oauth client ID from step 3.3 |
| 32 | +5. Follow the series of queries in https://developers.google.com/nest/device-access/authorize to authorize devices |
39 | 33 |
|
40 |
| -5. Click "`Create New Product <https://developers.nest.com/products/new>`_" |
| 34 | +You should end up with the following pieces of information: |
| 35 | +* project-id - ID of the project you created in https://console.nest.google.com/device-access |
| 36 | +* oauth_client_id - value from setting up OAuth in https://console.cloud.google.com/ project |
| 37 | +* client_secret - value from setting up OAuth in https://console.cloud.google.com/ project |
| 38 | +* authorization_code - You get this value when you authorize your https://console.nest.google.com/device-access project to access your devices |
| 39 | +* access-token - Token used to make requests to https://smartdevicemanagement.googleapis.com |
| 40 | +* refresh-token - Used to get a new access-token when the old one expires |
41 | 41 |
|
42 |
| -6. Fill in details: |
| 42 | +Be careful as you follow along the guide in <https://developers.google.com/nest/device-access/get-started>, since you're dealing with so many similar accounts and keys it can be easy to mix something up and you won't get particularly useful errors. |
43 | 43 |
|
44 |
| - - Product name must be unique. |
| 44 | +## Usage |
45 | 45 |
|
46 |
| - - The description, users, urls can all be anything you want. |
47 | 46 |
|
48 |
| -7. For permissions, check every box and if it's an option select the read/write option. |
49 |
| - |
50 |
| - - The description requires a specific format to be accepted. |
51 |
| - |
52 |
| -8. Click "Create Product". |
53 |
| - |
54 |
| -9. Once the new product page opens the "Product ID" and "Product Secret" are located on the right side. These will be used as client_id and client_secret below. |
55 |
| - |
56 |
| - |
57 |
| -Usage |
58 |
| -===== |
59 |
| - |
60 |
| -Migrate to 4.x |
61 |
| --------------- |
62 |
| -The version 4.x uses `Nest Stream API <https://developers.nest.com/documentation/cloud/rest-streaming-guide>`_, so that you can get nearly real time status update of your Nest devices. |
63 | 47 |
|
64 | 48 | If you use python-nest as a command line tool:
|
65 | 49 | You don't need to change, but there is a new command line option ``--keep-alive`` you can give a try.
|
@@ -303,6 +287,6 @@ The ``[NEST]`` section may also be named ``[nest]`` for convenience. Do not use
|
303 | 287 |
|
304 | 288 | History
|
305 | 289 | =======
|
306 |
| - |
307 |
| -This module was originally a fork of `nest_thermostat <https://github.com/FiloSottile/nest_thermostat>`_ |
| 290 | +This module was originally a fork of `python-nest <https://github.com/jkoelker/python-nest>`_ |
| 291 | +which was a fork of `nest_thermostat <https://github.com/FiloSottile/nest_thermostat>`_ |
308 | 292 | which was a fork of `pynest <https://github.com/smbaker/pynest>`_
|
0 commit comments