Updates to the Google Assistant setup instructions (#16015)

Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
Fredrik Andersson 2021-03-03 10:20:34 +01:00 committed by GitHub
parent a6b0bd1104
commit b5d64ae910
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,34 +29,40 @@ To use Google Assistant, your Home Assistant configuration has to be [externally
</div> </div>
### Google Cloud Platform configuration
1. Create a new project in the [Actions on Google console](https://console.actions.google.com/). 1. Create a new project in the [Actions on Google console](https://console.actions.google.com/).
1. Click `New Project` and give your project a name. 1. Click `New Project` and give your project a name.
2. Click on the `Smart Home` card, then click the `Start Building` button. 2. Click on the `Smart Home` card, then click the `Start Building` button.
3. Click `Name your Smart Home action` under `Quick Setup` to give your Action a name - Home Assistant will appear in the Google Home app as `[test] <Action Name>` 3. Click `Name your Smart Home action` under `Quick Setup` to give your Action a name - Home Assistant will appear in the Google Home app as `[test] <Action Name>`
4. Click `Build your Action`, then click `Add Action(s)`. 4. Click on the `Overview` tab at the top of the page to go back.
5. Add your Home Assistant URL: `https://[YOUR HOME ASSISTANT URL:PORT]/api/google_assistant` in the `Fulfillment URL` box, replace the `[YOUR HOME ASSISTANT URL:PORT]` with the domain / IP address and the port under which your Home Assistant is reachable. 5. Click `Build your Action`, then click `Add Action(s)`.
6. Click `Save`. 6. Add your Home Assistant URL: `https://[YOUR HOME ASSISTANT URL:PORT]/api/google_assistant` in the `Fulfillment URL` box, replace the `[YOUR HOME ASSISTANT URL:PORT]` with the domain / IP address and the port under which your Home Assistant is reachable.
7. Click on the `Overview` tab, which will lead you back to the app details screen. 7. Click `Save`.
8. Click the three little dots (more) icon in the upper right corner, select `Project settings`
9. Make note of the `Project ID` that are listed on the `GENERAL` tab of the `Settings` page.
2. `Account linking` is required for your app to interact with Home Assistant. 2. `Account linking` is required for your app to interact with Home Assistant.
1. Set this up by clicking on `Setup account linking` under the `Quick Setup` section of the `Overview` page. 1. Start by going back to the `Overview` tab.
2. If asked, leave options as they default `No, I only want to allow account creation on my website` and select `Next`. 2. Click on `Setup account linking` under the `Quick Setup` section of the `Overview` page.
3. Then if asked, for the `Linking type` select `OAuth` and `Authorization Code`. Click `Next` 3. If asked, leave options as they default `No, I only want to allow account creation on my website` and select `Next`.
4. Enter the following: 4. Then if asked, for the `Linking type` select `OAuth` and `Authorization Code`. Click `Next`
1. Client ID: `https://oauth-redirect.googleusercontent.com/r/YOUR_PROJECT_ID`. (Find your YOUR_PROJECT_ID by clicking on the three little dots (more) icon in the upper right corner of the console, selecting `Project settings`, your Project ID will be listed on the `GENERAL` tab of the `Settings` page.) 5. Enter the following:
2. Client Secret: Anything you like, Home Assistant doesn't need this field. 1. Client ID: `https://oauth-redirect.googleusercontent.com/r/[YOUR_PROJECT_ID]`. (Replace `[YOUR_PROJECT_ID]` with your project ID from above)
3. Authorization URL (replace with your actual URL): `https://[YOUR HOME ASSISTANT URL:PORT]/auth/authorize`. 2. Client Secret: Anything you like, Home Assistant doesn't need this field.
4. Token URL (replace with your actual URL): `https://[YOUR HOME ASSISTANT URL:PORT]/auth/token`. 3. Authorization URL: `https://[YOUR HOME ASSISTANT URL:PORT]/auth/authorize`. (Replace `[YOUR HOME ASSISTANT URL:PORT]` with your values.)
Click `Next`, then `Next` again. 4. Token URL (replace with your actual URL): `https://[YOUR HOME ASSISTANT URL:PORT]/auth/token`. (Replace `[YOUR HOME ASSISTANT URL:PORT]` with your values.)
5. In the `Configure your client` `Scopes` textbox, type `email` and click `Add scope`, then type `name` and click `Add scope` again. Click `Next`, then `Next` again.
6. Do **NOT** check `Google to transmit clientID and secret via HTTP basic auth header`. 6. In the `Configure your client` `Scopes` textbox, type `email` and click `Add scope`, then type `name` and click `Add scope` again.
7. Click `Next`, then click `Save` 7. Do **NOT** check `Google to transmit clientID and secret via HTTP basic auth header`.
8. Click `Next`, then click `Save`
<img src='/images/integrations/google_assistant/accountlinking.png' alt='Screenshot: Account linking'> <img src='/images/integrations/google_assistant/accountlinking.png' alt='Screenshot: Account linking'>
3. Select the `Develop` tab at the top of the page, then in the upper right hand corner select the `Test` button to generate the draft version Test App. If you don't see this option, go to the `Test` tab instead, click on the `Settings` button in the top right below the header, and ensure `On device testing` is enabled (if it isn't, enable it). 3. Select the `Develop` tab at the top of the page, then in the upper right hand corner select the `Test` button to generate the draft version Test App. If you don't see this option, go to the `Test` tab instead, click on the `Settings` button in the top right below the header, and ensure `On device testing` is enabled (if it isn't, enable it).
4. Add the `google_assistant` integration configuration to your `configuration.yaml` file and restart Home Assistant following the [configuration guide](#configuration) below. 4. Add the `google_assistant` integration configuration to your `configuration.yaml` file and restart Home Assistant following the [configuration guide](#configuration) below.
5. (Note that app versions may be slightly different.) Open the Google Home app and go to `Settings`. 5. Add services in the Google Home App (Note that app versions may be slightly different.)
6. Click `Add...`, `+ Set up or add`, `+ Set up device`, and click `Have something already setup?`. You should have `[test] your app name` listed under 'Add new'. Selecting that should lead you to a browser to login your Home Assistant instance, then redirect back to a screen where you can set rooms and nicknames for your devices if you wish. 1. Open the Google Home app and go to `Settings`.
2. Click `Add...`, `+ Set up or add`, `+ Set up device`, and click `Have something already setup?`. You should have `[test] your app name` listed under 'Add new'. Selecting that should lead you to a browser to login your Home Assistant instance, then redirect back to a screen where you can set rooms and nicknames for your devices if you wish.
<div class='note'> <div class='note'>
@ -83,20 +89,24 @@ If you want to allow other household users to control the devices:
If you want to support active reporting of state to Google's server (configuration option `report_state`) and synchronize Home Assistant devices with the Google Home app (`google_assistant.request_sync` service), you will need to create a service account. It is recommended to set up this configuration key as it also allows the usage of the following command, "Ok Google, sync my devices". Once you have set up this component, you will need to call this service (or command) each time you add a new device in Home Assistant that you wish to control via the Google Assistant integration. This allows you to update devices without unlinking and relinking an account (see [below](#troubleshooting)). If you want to support active reporting of state to Google's server (configuration option `report_state`) and synchronize Home Assistant devices with the Google Home app (`google_assistant.request_sync` service), you will need to create a service account. It is recommended to set up this configuration key as it also allows the usage of the following command, "Ok Google, sync my devices". Once you have set up this component, you will need to call this service (or command) each time you add a new device in Home Assistant that you wish to control via the Google Assistant integration. This allows you to update devices without unlinking and relinking an account (see [below](#troubleshooting)).
1. In the GCP Console, go to the [Create Service account key](https://console.cloud.google.com/apis/credentials/serviceaccountkey) page. 1. Service Account
2. At the top left of the page next to "Google Cloud Platform" logo, select your project created in the Actions on Google console. Confirm this by reviewing the `project_id` and it ensure it matches. 1. In the Google Cloud Platform Console, go to the [Create Service account key](https://console.cloud.google.com/apis/credentials/serviceaccountkey) page.
3. From the Service account list, select New service account. 2. At the top left of the page next to "Google Cloud Platform" logo, select your project created in the Actions on Google console. Confirm this by reviewing the project ID and it ensure it matches.
4. In the Service account name field, enter a name. 3. From the Service account list, select New service account.
5. In the Service account ID field, enter an ID. 4. In the Service account name field, enter a name.
6. From the Role list, select Service Accounts > Service Account Token Creator. 5. In the Service account ID field, enter an ID.
7. For the Key type, select the JSON option. 6. From the Role list, select `Service Accounts` > `Service Account Token Creator`.
8. Click Create. A JSON file that contains your key downloads to your computer. 7. For the Key type, select the JSON option.
9. Use the information in this file or the file directly to add to the `service_account` key in the configuration. 8. Click `Create`. A JSON file that contains your key downloads to your computer.
10. Go to the [Google API Console](https://console.cloud.google.com/apis/api/homegraph.googleapis.com/overview). 9. Use the information in this file or the file directly to add to the `service_account` key in the configuration.
11. Select your project and click Enable HomeGraph API. 10. Click `close`.
12. Try "OK Google, sync my devices" - the Google Home app should import your exposed Home Assistant devices and prompt you to assign them to rooms 2. HomeGraph API
1. Go to the [Google API Console](https://console.cloud.google.com/apis/api/homegraph.googleapis.com/overview).
2. At the top left of the page next to "Google Cloud Platform" logo, select your project created in the Actions on Google console. Confirm this by reviewing the project ID and it ensure it matches.
3. Click Enable HomeGraph API.
3. Try "OK Google, sync my devices" - the Google Home app should import your exposed Home Assistant devices and prompt you to assign them to rooms.
### Configuration ### YAML Configuration
Now add your setup to your `configuration.yaml` file, such as: Now add your setup to your `configuration.yaml` file, such as: