google_assistant integration allows you to control things via Google Assistant on your mobile, tablet or Google Home device.
With Home Assistant Cloud, you can connect your Home Assistant instance in a few simple clicks to Google Assistant. With Home Assistant Cloud you don’t have to deal with dynamic DNS, SSL certificates or opening ports on your router. Just log in via the user interface and a secure connection with the cloud will be established. Home Assistant Cloud requires a paid subscription after a 30-day free trial.
For Home Assistant Cloud Users, documentation can be found here.
The Google Assistant integration (without Home Assistant Cloud) 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. If you make DNS changes to accomplish this, please ensure you have allowed up to the full 48 hours for DNS changes to propagate, otherwise Google may not be able to reach your server.
You will need to create a service account Create Service account key which allows you to update devices without unlinking and relinking an account (see below). If you don’t provide the service account, the
google_assistant.request_sync service is not exposed. 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. See Step 2 after the note for more details.
Create a new project in the Actions on Google console.
- Add/Import a project and give it a name.
- Click on the
Smart Homecard, select the
Build your Action, select
Add Action(s). Add your Home Assistant URL:
https://[YOUR HOME ASSISTANT URL:PORT]/api/google_assistantin the
Fulfillment URLbox, replace the
[YOUR HOME ASSISTANT URL:PORT]with the domain / IP address and the port under which your Home Assistant is reachable.
Save. Then click on
Overview, which will lead you back to the app details screen.
Account linkingis required for your app to interact with Home Assistant. Set this up under the
- Leave it at the default
No, I only want to allow account creation on my websiteand select
- For the
Authorization Code. Click
- Client ID:
- Client Secret: Anything you like, Home Assistant doesn’t need this field.
- Authorization URL (replace with your actual URL):
https://[YOUR HOME ASSISTANT URL:PORT]/auth/authorize.
- Token URL (replace with your actual URL):
https://[YOUR HOME ASSISTANT URL:PORT]/auth/token. Click
- Configure your client: Type
Add scope, then type
- Do NOT check
Google to transmit clientID and secret via HTTP basic auth header. Click
- Testing instructions: Enter anything. It doesn’t matter since you won’t submit this app. Click
- Leave it at the default
Developtab at the top of the page, then in the upper right hand corner select the
Testbutton to generate the draft version Test App.
google_assistantintegration configuration to your
configuration.yamlfile and restart Home Assistant following the configuration guide below.
(Note that app versions may be slightly different.) Open the Google Home app and go to
+ Set up or add,
+ Set up device, and click
Have something already setup?. You should have
[test] your app namelisted 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.
If you’ve added Home Assistant to your phone’s home screen, you have to first remove it from home screen, otherwise, this HTML5 app will show up instead of a browser. Using it would prevent Home Assistant redirecting back to the Google Home app.
- If you want to allow other household users to control the devices:
- Go to the settings for the project you created in the Actions on Google console.
Test -> Simulator, then click
Shareicon in the right top corner. Follow the on-screen instruction:
- Add team members: Got to
Settings -> Permission, click
Add, type the new user’s e-mail address and choose
Project -> Viewerrole.
- Copy and share the link with the new user.
- When the new user opens the link with their own Google account, it will enable your draft test app under their account.
- Add team members: Got to
- Have the new user go to their
Google Assistantapp to add
[test] your app nameto their account.
- If you want to support actively reporting of state to Google’s server (configuration option
report_state) and support
google_assistant.request_sync, you need to generate a service account.
- In the GCP Console, go to the Create Service account key page.
- From the Service account list, select New service account.
- In the Service account name field, enter a name.
- In the Service account ID field, enter an ID.
- From the Role list, select Service Accounts > Service Account Token Creator.
- For the Key type, select the JSON option.
- Click Create. A JSON file that contains your key downloads to your computer.
- Use the information in this file or the file directly to add to the
service_accountkey in the configuration.
- Go to the Google API Console.
- Select your project and click Enable HomeGraph API.
Now add your setup to your
configuration.yaml file, such as:
# Example configuration.yaml entry google_assistant: project_id: YOUR_PROJECT_ID service_account: !include SERVICE_ACCOUNT.JSON report_state: true exposed_domains: - switch - light entity_config: switch.kitchen: name: CUSTOM_NAME_FOR_GOOGLE_ASSISTANT aliases: - BRIGHT_LIGHTS - ENTRY_LIGHTS light.living_room: expose: false room: LIVING_ROOM
Project ID from the Actions on Google console (looks like
Pin code to say when you want to interact with a secure device.
Your HomeGraph API key (for the
google_assistant.request_syncservice). This is not required if a service_account is specified. This has been deprecated and will be removed in 0.105, you must setup a
Service account information. You can use an include statement with your downloaded JSON file, enter data here directly or use secrets file to populate.
Actively report state changes on entities. This speeds up response time for actions affecting multiple entities since Google Assistant knows pre-hand what state they are. It is also required for some features on visual controls.
Expose devices in all supported domains by default. If
exposed_domainsdomains is set, only these domains are exposed by default. If
expose_by_defaultis set to false, devices have to be manually exposed in
List of entity domains to expose to Google Assistant if
expose_by_defaultis set to true. This has no effect if
expose_by_defaultis set to false.
Entity specific configuration for Google Assistant
Entity to configure
Name of the entity to show in Google Assistant
Force an entity to be exposed/excluded.
Aliases that can also be used to refer to this entity
Allows for associating this device to a Room in Google Assistant.
Currently, the following domains are available to be used with Google Assistant, listed with their default types:
- alarm_control_panel (arm/disarm)
- camera (streaming, requires compatible camera)
- group (on/off)
- input_boolean (on/off)
- input_select (option/setting/mode/value)
- scene (on)
- script (on)
- switch (on/off)
- fan (on/off/speed)
- light (on/off/brightness/rgb color/color temp)
- cover (on/off/set position)
- media_player (on/off/set volume (via set volume)/source (via set input source)/control playback)
- climate (temperature setting, hvac_mode)
- vacuum (dock/start/stop/pause)
- sensor (temperature setting for temperature sensors and humidity setting for humidity sensors)
Some of these devices may not display correctly in the Google Home app, such as media_player, however voice commands will still work.
Certain devices are considered secure, including anything in the
alarm_control_panel domain and
covers with device types
By default these cannot be opened by Google Assistant unless a
secure_devices_pin is set up. To allow opening, set the
secure_devices_pin to something and you will be prompted to speak the pin when opening the device. Closing or locking these devices does not require a pin.
For the Alarm Control Panel if a code is set it must be the same as the
code_arm_required is set to
false the system will arm without prompting for the pin.
Entities that have not been explicitly assigned to rooms but have been placed in Home Assistant areas will return room hints to Google with the devices in those areas.
There is not an exact 1-1 match between Home Assistant and Google Assistant for the available operation modes. Here are the modes that are currently available:
- heatcool (auto)
Syncing may fail after a period of time, likely around 30 days, due to the fact that your Actions on Google app is technically in testing mode and has never been published. Eventually, it seems that the test expires. Control of devices will continue to work but syncing may not. If you say “Ok Google, sync my devices” and get the response “Unable to sync Home Assistant” (or whatever you named your project), this can usually be resolved by going back to your test app in the Actions on Google console and clicking
TEST. Regenerate the draft version Test App and try asking Google to sync your devices again. If regenerating the draft does not work, go back to the
Action section and just hit the
enter key for the URL to recreate the Preview.
request_sync service requires that the initial sync from Google includes the
agent_user_id. If not, the service will log an error that reads something like “Request contains an invalid argument”. If this happens, then unlink the account from Home Control and relink.
request_sync service may fail with a 404 if the
project_id of the HomeGraph API differs from the
project_id of the Actions SDK found in the preferences of your project on Actions on Google console. Resolve this by:
- Removing your project from the Actions on Google console.
- Add a new project to the Google Cloud API Console. Here you get a new
- Enable HomeGraph API to the new project.
- Generate a new API key.
- Again, create a new project in the Actions on Google console. Described above. But at the step ‘Build under the Actions SDK box’ choose your newly created project. By this, they share the same
When using NGINX, ensure that your
proxy_pass line does not have a trailing
/, as this will result in errors. Your line should look like:
If you’re having trouble with Account linking failed after you unlinked your service, try clearing the browser history and cache.