5.5 KiB
layout, title, description, date, sidebar, comments, sharing, footer, logo, ha_category, featured, ha_release
layout | title | description | date | sidebar | comments | sharing | footer | logo | ha_category | featured | ha_release |
---|---|---|---|---|---|---|---|---|---|---|---|
page | Google Assistant | Setup for Google Assistant integration | 2017-10-17 12:30 | true | false | true | true | google-assistant.png | Voice | true | 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.
To use Google Assistant your Home Assistant configuration has to be externally accessible, with a hostname and SSL certificate. If you haven't already configured that you should do so before continuing.
{% linkable_title Configuration %}
# 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]
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 the credentials to your Home Assistant instance. You can generate them with the following command:
cat /dev/urandom|fold -w 120|head -n 1|base64 -w 0|tr -dc '0-9A-Za-z'|cut -c -80
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.
- exposed_domains (Optional): An array of Home Assistant domains to expose to Google Assistant. Options include:
switch
light
cover
media_player
group
fan
scene
script
You can also customize your devices similar to other components by adding keys to entities:
homeassistant:
customize:
master_bedroom_light:
google_assistant: true
google_assistant_name: bedroom light
bedroom_blinds:
aliases:
- bedroom shades
- bedroom covers
hallway_ceiling_switch:
google_assistant: true
google_assistant_type: light
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. - google_assistant_type: Can be used to override the domain/type of an entity. For example a switch can be treated as a light
- aliases: Provides "nicknames" to Google Assistant. These function as alternate names for an entity that Assistant will understand when spoken.
{% linkable_title Setup %}
- Install the gactions CLI (you'll use this later) - you can download this anywhere, just remember where you put it for later (and don't forget to run
chmod +x gactions
) - Create a new file named
project.json
(in the same directory you downloadedgactions
to) 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.
{
"actions": [{
"name": "actions.devices",
"deviceControl": {
},
"fulfillment": {
"conversationName": "automation"
}
}],
"conversations": {
"automation" :
{
"name": "automation",
"url": "https://[YOUR HOME ASSISTANT URL]/api/google_assistant"
}
}
}
- Create a new project in the developer console.
- Add/Import project
- Go to Build under the Actions SDK box
- Copy the command that looks like:
gactions update --action_package PACKAGE_NAME --project doctest-2d0b8
- Replace
PACKAGE_NAME
withproject.json
and run that command from the same directory you savedproject.json
in (you'll need to put./
beforegactions
so that it reads./gactions
). It should output a URL likehttps://console.actions.google.com/project/doctest-2d0b8/overview
- go there. - 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.
- The final item on that page
Account linking
is required for your app to interact with Home Assistant.- Grant type:
Implicit
- Client ID: Should be the same as
client_id
from your hass config above - Authorization URL (replace with your actual URL):
https://[YOUR HOME ASSISTANT URL]/api/google_assistant/auth
- Configure your client. Add scopes for
email
andname
- Testing instructions: doesn't matter since you won't submit this app
- Grant type:
- 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. - Open the Google Assistant app and go into
Settings > Home Control
- 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. - If you want to allow other houshold users to control the devices:
- Go to the developer console using address from point 4.
- Under the gear icon, click
Permissions
- Click
Add
, type the new user's e-mail address and chooseProject -> Editor
role - Have the new user go to developer console and repeat steps starting from point 7.