From 38f379922768b7fd5473b7c130a2d247caa07d4d Mon Sep 17 00:00:00 2001 From: Phil Kates Date: Tue, 17 Oct 2017 01:06:01 -0700 Subject: [PATCH 1/4] Add google_assistant component --- source/_components/google_assistant.markdown | 101 ++++++++++++++++++ .../supported_brands/google-assistant.png | Bin 0 -> 6935 bytes 2 files changed, 101 insertions(+) create mode 100644 source/_components/google_assistant.markdown create mode 100644 source/images/supported_brands/google-assistant.png diff --git a/source/_components/google_assistant.markdown b/source/_components/google_assistant.markdown new file mode 100644 index 000000000000..41c823ae4e59 --- /dev/null +++ b/source/_components/google_assistant.markdown @@ -0,0 +1,101 @@ +--- +layout: page +title: "Google Assistant" +description: "Setup for Google Assistant integration" +date: 2017-10-17 12:30 +sidebar: true +comments: false +sharing: true +footer: true +logo: google-assistant.png +ha_category: Voice +featured: true +ha_release: 0.56 +--- + +# Google Assistant Docs +The Google Assistant component requires a bit more setup than most due to the way Google requires Assistant Apps to be set up. + +### {% linkable_title Configuration %} + +```yaml +# Example configuration.yaml entry +google_assistant: + project_id: someproject-2d0b8 + client_id: [long random string] + access_token: [different long random string] + exposed_domains: + - switch + - light + - group +``` + +*Note:* It's very important that you use something very long strings for `client_id` and `access_token`. Those are essentially credentials to your Home Assistant instance. + +*Configuration Variables:* +* *expose_by_default* (Optional): Expose devices in all supported domains by default. +* *project_id* (Required): Project ID from the Google Developer console (looks like `words-2ab12`) +* *client_id* (Required): A long random url safe string (no spaces or special characters) that will be used for Implicit OAuth. +* *access_token* (Required): Another long random url safe string. +* *exposed domains* (Optional): An array of Home Assistant domains to expose to Google Assistant. + +You can also customize your devices similar to other components by adding keys to entities: + +```yaml +homeassistant: + customize: + master_bedroom_light: + google_assistant: true + google_assistant_name: bedroom light + bedroom_blinds: + aliases: + - bedroom shades + - bedroom covers +``` + +*Entity Customization Keys:* +* *google_assistant*: True exposes entity, false will hide it +* *google_assistant_name*: Can be used to override the primary name of an entity. By default the `friendly_name` of an entity is used. +* *aliases*: Provides "nicknames" to Google Assistant. These function as alternate names for an entity that Assistant will understand when spoken. + +### {% linkable_title Setup %} + +1. Install the [gactions CLI](https://developers.google.com/actions/tools/gactions-cli) (you'll use this later) +2. Create a new file named `project.json` and replace the hostname with your hostname in the URL. Note: This must be an HTTPS URL to work. + +```json +{ + "actions": [{ + "name": "actions.devices", + "deviceControl": { + }, + "fulfillment": { + "conversationName": "automation" + } + }], + "conversations": { + "automation" : + { + "name": "automation", + "url": "https://example.com/api/google_assistant" + } + } +} +``` + +3. Create a new project in the [developer console](https://console.actions.google.com/). + 1. Add/Import project + 2. Go to Build under the Actions SDK box + 3. Copy the command that looks like: + `gactions update --action_package PACKAGE_NAME --project doctest-2d0b8` +4. Replace `PACKAGE_NAME` with `project.json` and run that command from the same directory you saved `project.json` in. It should output a URL like `https://console.actions.google.com/project/doctest-2d0b8/overview` Go there. +5. You'll need to fill out most of the information on that page but none of it really matters since you won't be addressing the App directly, only through the Smart Home functionality built into Google Assistant. +6. The final item on that page `Account linking` is required for your app to interact with Home Assistant. + 1. Grant type: `Implicit` + 2. Client ID: Make up a random-ish or hard to guess string + 3. Authorization URL (replace example.com): `https://example.com/api/google_assistant/auth` + 4. Configure your client. Add scopes for `email` and `name` + 5. Testing instructions: doesn't matter since you won't submit this app +7. Back on the main app draft page. Click `Test Draft`. That will take you to the simulator (which won't work) so just close that window. +8. Open the Google Assistant app and go into `Settings > Home Control` +9. Click the `+` sign and near the bottom you should have `[test] your app name`. Selecting that should lead to you the screen where you can set rooms for your devices or nicknames for your devices. diff --git a/source/images/supported_brands/google-assistant.png b/source/images/supported_brands/google-assistant.png new file mode 100644 index 0000000000000000000000000000000000000000..16a47ab4884ebc86c5d66c0aaf43cb77998df553 GIT binary patch literal 6935 zcma)BWmFWvw_lniWI-B%r9)SmrDbucrIrv00VR}>?(R-W>FyF)Qc5}m>26jUq@?5V zf1lom_s)4AX6BsV+_~r8nLG2FI}?snl_w^kB>(^b#EJ@VjmNhCKLsE6v98pq$^rmr zmlfeKEw_yQO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>8+$R07B!`31cHA0)K78!;MBw>DCe1-I{T4Xgi>jx4CU~`B`ewPaj!btQJAPeVBbx0YV4=?6`Yxx?{8D#{46!yD_&hP&+dgQUU!f!bqClipi{=;n2(Z3_u#H~tQO&h7dMoRl z4O0QdM{J|rsPO4I^g@dpg}*IVlB;mOA37VM`=Rrp|1#h_luhw=M}+~)^zVAzkvyqx zKCCnDL=x?n7Z>dSTD+?=0O~fXy61USe-)Ujc?|2v@VHyiefbcGI1_uHH{}H-3nrA% zx;B{ETlf?{?uQF>9I;J;9_6{kjv2c!xJp}8p7aN$Dl5$FS_R~Mk;POr#JCX!xpgTB z6_ypEk|E^QPbeNkbkoZ|2$ggY;=2{g68>FTKEmgANdJj;vpyGkQ|E=YBA#5C2{1+fDJWT)q literal 0 HcmV?d00001 From d76120f6a45bc584581448a04eb735f500df0bc5 Mon Sep 17 00:00:00 2001 From: Phil Kates Date: Tue, 17 Oct 2017 14:20:07 -0700 Subject: [PATCH 2/4] Be more explict about config keys and replaced strings --- source/_components/google_assistant.markdown | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/source/_components/google_assistant.markdown b/source/_components/google_assistant.markdown index 41c823ae4e59..aab180e7ca02 100644 --- a/source/_components/google_assistant.markdown +++ b/source/_components/google_assistant.markdown @@ -22,15 +22,15 @@ The Google Assistant component requires a bit more setup than most due to the wa # Example configuration.yaml entry google_assistant: project_id: someproject-2d0b8 - client_id: [long random string] - access_token: [different long random string] + client_id: [long url safe random string] + access_token: [a different long url safe random string] exposed_domains: - switch - light - group ``` -*Note:* It's very important that you use something very long strings for `client_id` and `access_token`. Those are essentially credentials to your Home Assistant instance. +*Note:* It's very important that you use very long strings for `client_id` and `access_token`. Those are essentially credentials to your Home Assistant instance. *Configuration Variables:* * *expose_by_default* (Optional): Expose devices in all supported domains by default. @@ -61,7 +61,8 @@ homeassistant: ### {% linkable_title Setup %} 1. Install the [gactions CLI](https://developers.google.com/actions/tools/gactions-cli) (you'll use this later) -2. Create a new file named `project.json` and replace the hostname with your hostname in the URL. Note: This must be an HTTPS URL to work. +2. Create a new file named `project.json` and replace the `[YOUR HOME ASSISTANT URL]` below with the URL you use to access Home Assistant. + Note: This must be an HTTPS URL to work. ```json { @@ -77,7 +78,7 @@ homeassistant: "automation" : { "name": "automation", - "url": "https://example.com/api/google_assistant" + "url": "https://[YOUR HOME ASSISTANT URL]/api/google_assistant" } } } @@ -92,8 +93,8 @@ homeassistant: 5. You'll need to fill out most of the information on that page but none of it really matters since you won't be addressing the App directly, only through the Smart Home functionality built into Google Assistant. 6. The final item on that page `Account linking` is required for your app to interact with Home Assistant. 1. Grant type: `Implicit` - 2. Client ID: Make up a random-ish or hard to guess string - 3. Authorization URL (replace example.com): `https://example.com/api/google_assistant/auth` + 2. Client ID: Should be the same as `client_id` from your hass config above + 3. Authorization URL (replace with your actual URL): `https://[YOUR HOME ASSISTANT URL]/api/google_assistant/auth` 4. Configure your client. Add scopes for `email` and `name` 5. Testing instructions: doesn't matter since you won't submit this app 7. Back on the main app draft page. Click `Test Draft`. That will take you to the simulator (which won't work) so just close that window. From 5c79e921f66fa897d5fab6961cbb1dd48da736ad Mon Sep 17 00:00:00 2001 From: Phil Kates Date: Tue, 17 Oct 2017 14:24:18 -0700 Subject: [PATCH 3/4] Fix typo and minor language change --- source/_components/google_assistant.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/_components/google_assistant.markdown b/source/_components/google_assistant.markdown index aab180e7ca02..575470f7749d 100644 --- a/source/_components/google_assistant.markdown +++ b/source/_components/google_assistant.markdown @@ -36,8 +36,8 @@ google_assistant: * *expose_by_default* (Optional): Expose devices in all supported domains by default. * *project_id* (Required): Project ID from the Google Developer console (looks like `words-2ab12`) * *client_id* (Required): A long random url safe string (no spaces or special characters) that will be used for Implicit OAuth. -* *access_token* (Required): Another long random url safe string. -* *exposed domains* (Optional): An array of Home Assistant domains to expose to Google Assistant. +* *access_token* (Required): Another different long random url safe string. +* *exposed_domains* (Optional): An array of Home Assistant domains to expose to Google Assistant. You can also customize your devices similar to other components by adding keys to entities: From 7f1a6c9b7c9599503bfb18de8dd7b8bd4787fd22 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 18 Oct 2017 21:33:33 +0200 Subject: [PATCH 4/4] Some minor spelling & grammar fixes --- source/_components/google_assistant.markdown | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/_components/google_assistant.markdown b/source/_components/google_assistant.markdown index 575470f7749d..583466f41291 100644 --- a/source/_components/google_assistant.markdown +++ b/source/_components/google_assistant.markdown @@ -22,21 +22,21 @@ The Google Assistant component requires a bit more setup than most due to the wa # Example configuration.yaml entry google_assistant: project_id: someproject-2d0b8 - client_id: [long url safe random string] - access_token: [a different long url safe random string] + client_id: [long URL safe random string] + access_token: [a different long URL safe random string] exposed_domains: - switch - light - group ``` -*Note:* It's very important that you use very long strings for `client_id` and `access_token`. Those are essentially credentials to your Home Assistant instance. +*Note:* It's very important that you use very long strings for `client_id` and `access_token`. Those are essentially the credentials to your Home Assistant instance. *Configuration Variables:* * *expose_by_default* (Optional): Expose devices in all supported domains by default. * *project_id* (Required): Project ID from the Google Developer console (looks like `words-2ab12`) -* *client_id* (Required): A long random url safe string (no spaces or special characters) that will be used for Implicit OAuth. -* *access_token* (Required): Another different long random url safe string. +* *client_id* (Required): A long random URL safe string (no spaces or special characters) that will be used for Implicit OAuth. +* *access_token* (Required): Another different long random URL safe string. * *exposed_domains* (Optional): An array of Home Assistant domains to expose to Google Assistant. You can also customize your devices similar to other components by adding keys to entities: @@ -90,7 +90,7 @@ homeassistant: 3. Copy the command that looks like: `gactions update --action_package PACKAGE_NAME --project doctest-2d0b8` 4. Replace `PACKAGE_NAME` with `project.json` and run that command from the same directory you saved `project.json` in. It should output a URL like `https://console.actions.google.com/project/doctest-2d0b8/overview` Go there. -5. You'll need to fill out most of the information on that page but none of it really matters since you won't be addressing the App directly, only through the Smart Home functionality built into Google Assistant. +5. You'll need to fill out most of the information on that page, but none of it really matters since you won't be addressing the App directly, only through the Smart Home functionality built into Google Assistant. 6. The final item on that page `Account linking` is required for your app to interact with Home Assistant. 1. Grant type: `Implicit` 2. Client ID: Should be the same as `client_id` from your hass config above @@ -99,4 +99,4 @@ homeassistant: 5. Testing instructions: doesn't matter since you won't submit this app 7. Back on the main app draft page. Click `Test Draft`. That will take you to the simulator (which won't work) so just close that window. 8. Open the Google Assistant app and go into `Settings > Home Control` -9. Click the `+` sign and near the bottom you should have `[test] your app name`. Selecting that should lead to you the screen where you can set rooms for your devices or nicknames for your devices. +9. Click the `+` sign, and near the bottom, you should have `[test] your app name`. Selecting that should lead to you the screen where you can set rooms for your devices or nicknames for your devices.