Aeroverra / StreamDeck-Nest-Control

Control your nest thermostat from the Stream Deck
6 stars 2 forks source link

NestControl

Special Thanks to naethure for adding support for Heat + Cool

The Nest Control pluginallows you to integrate your Google Nest devices with Stream Deck. This integration uses the Smart Device Management API and Google’s Cloud Pubsub to efficiently listen for changes in device state or other events. See Supported Devices for all devices supported by the SDM API.

There is currently only support for climate control devices like the Nest Thermostat.

You are in control of the information and capabilities exposed to Nest Control. You can authorize a single device or multiple devices.

The Nest Smart Device Management (SDM) API requires a US$5 fee. (Paid To Google)

Device Access Registration

For the first phase, you will turn on the API and create the necessary credentials to have Nest Control talk to the Nest API.

Create and configure Cloud Project [Cloud Console]

By the end of this section you will have a Cloud Project with the necessary APIs enabled

  1. Go to the Google Cloud Console.

  2. If this is your first time here, you likely need to create a new Google Cloud project. Click Create Project then New Project. Screenshot of APIs and Services Cloud Console with no existing project

  3. Give your Cloud Project a name then click Create.

  4. Go to APIs & Services > Library where you can enable APIs.

  5. From the API Library search for Smart Device management and click Enable.

    Screenshot of Search for SDM API

  6. From the API Library search for Cloud Pub/Sub API in the Cloud Console and click Enable.

  7. Go to the Google Cloud Console Dashboard

  8. Here you will see your Cloud Project Id. Copy it and place it into the Nest Control configuration

You now have a cloud project ready for the next section to configure authentication with OAuth.

Configure OAuth Consent screen [Cloud Console]

By the end of this section you will have configured the OAuth Consent Screen, needed for giving Nest Control access to your cloud project.

  1. Go to the Google API Console.

  2. Click OAuth consent screen and configure it.

  3. Select External (the only choice if you are not a G-Suite user) then click Create. While you are here, you may click the Let us know what you think to give Google’s OAuth team any feedback about your experience configuring credentials for self-hosted software. They make regular improvements to this flow and appear to value feedback. Screenshot of OAuth consent screen creation

  4. The App Information screen needs you to enter an App name and User support email, then enter your email again under Developer contact email. These are only shown while you later go through the OAuth flow to authorize Nest Control to access your account. Click Save and Continue. Omit unnecessary information (e.g. logo) to avoid additional review by Google.

  5. On the Scopes step click Save and Continue.

  6. On the Test Users step, you need to add your Google Account (e.g., your @gmail.com address) to the list. Click Save on your test account then Save and Continue to finish the consent flow. Screenshot of OAuth consent screen test users

  7. Navigate back to the OAuth consent screen and click Publish App to set the Publishing status is In Production.

    Screenshot of OAuth consent screen production status

  8. The warning says your app will be available to any user with a Google Account which refers to the fields you entered on the App Information screen if someone finds the URL. This does not expose your Google Account or Nest data.

  9. Make sure the status is not Testing, or you will get logged out every 7 days.

Configure OAuth client_id and client_secret [Cloud Console]

By the end of this section you will have the client_id and client_secret which you need to add to the plugin configuration.

The steps below use Web Application Auth with Nest Control to handle Google’s strict URL validation rules.

  1. Navigate to the Credentials page and click Create Credentials. Screenshot of APIs and Services Cloud Console

  2. From the drop-down list select OAuth client ID. Screenshot of OAuth client ID selection

  3. Enter Web Application for the Application type.

  4. Pick a name for your credential.

  5. Add Authorized redirect URIs and enter http://localhost:20777

  6. Click Create to create the credential. Screenshot of creating OAuth credentials

  7. You should now be presented with an OAuth client created message. You should now see your Your Client ID and Your Client Secret. Add these to your Nest Control configuration.Screenshot of OAuth Client ID and Client Secret

Create a Device Access project_id [Device Access Console]

Now that you have authentication configured, you will create a Nest Device Access Project which requires a US$5 fee. Once completed, you will have a device access project_id needed for later steps.

  1. Go to the Device Access Registration page. Click on the button Go to the Device Access Console. Screenshot of Device Access Registration

  2. Check the box to “Accept the Terms of Service” and click Continue to Payment where you need to pay a fee (currently US$5). Screenshot of accepting terms

    It is currently not possible to share/be invited to a home with a G-Suite account. Make sure that you pay the fee with an account that has access to your devices.

  3. Now the Device Access Console should be visible. Click on Create project.

  4. Give your Device Access project a name and click Next. Screenshot of naming a project

  5. Next you will be asked for an OAuth client ID which you created in the previous step and click Next. Screenshot of Device Access Console OAuth client ID

  6. Enable Events by clicking on Enable and Create project. Screenshot of enabling events

  7. You will now see a Project ID. Place this in your Nest Control configuration. At this point you have the Cloud Project Id, Client Id ,Client Secret and Project Id which is everything you need for configuration.

    OAuth and Device Authorization steps

    In this section you will authorize Home Assistant to access your account by generating an Authentication Token.

    1. Click the setup button in the configuration)

    2. If you have multiple accounts make sure you select the Google account your Nest is linked which should be the same account you setup the API with.

    3. The Google Nest permissions screen will allow you to choose which devices to configure and lets you select devices from multiple homes. You likely want to enable everything, however, you can leave out any feature you do not wish to use with Nest Control.

    4. You will get redirected to another account selection page.

    5. You may see a warning screen that says Google hasn’t verified this app since you just set up an un-verified developer workflow. Click Continue to proceed.

  8. You may be asked to grant access to additional permissions. Click Allow

  9. Confirm you want to allow persistent access to Nest Control.

  10. You should now see a success message. Congratulations you have finished the plugin setup!