Google Assistant

Google Assistant

The google_assistant integration allows you to control things via Google Assistant on your mobile, pad or Google Home device .

Automatic setup via Home Assistant Cloud

With Home Assistant Cloud, you can connect your Home Assistant example in a few bare clicks to Google Assistant. With Home Assistant Cloud you don ’ t have to deal with active DNS, SSL certificates or opening ports on your router. Just logarithm in via the exploiter interface and a secure connection with the obscure will be established. Home Assistant Cloud requires a pay subscription after a 30-day free test .
For Home Assistant Cloud Users, documentation can be found here .

Manual setup

The Google Assistant consolidation ( without Home Assistant Cloud ) requires a bit more apparatus than most due to the way Google requires Assistant Apps to be set up.

Reading: Google Assistant

To use Google Assistant, your Home Assistant shape has to be externally accessible with a hostname and SSL certificate. If you haven ’ thymine 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. once you have confirmed you can reach your Home adjunct from outside your home network, you can set up the Google consolidation :

Google Cloud Platform configuration

  1. Create a modern undertaking in the Actions on Google comfort .

    1. Click New Project and give your project a name.
    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]
    4. Click on the Overview tab at the top of the page to go back.
    5. Click Build your Action, then click Add Action(s).
    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 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 .

    1. Start by going back to the Overview tab.
    2. Click on Setup account linking under the Quick Setup section of the Overview page.
    3. If asked, leave options as they default No, I only want to allow account creation on my website and select Next.
    4. Then if asked, for the Linking type select OAuth and Authorization Code. Click Next
    5. Enter the following:
      1. Client ID:[YOUR_PROJECT_ID]. (Replace [YOUR_PROJECT_ID] with your project ID from above)
      2. Client Secret: Anything you like, Home Assistant doesn’t need this field.
      3. Authorization URL: https://[YOUR HOME ASSISTANT URL:PORT]/auth/authorize. (Replace [YOUR HOME ASSISTANT URL:PORT] with your values.)
      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.)
        Click Next, then Next again.
    6. In the Configure your client Scopes textbox, type email and click Add scope, then type name and click Add scope again.
    7. Do NOT check Google to transmit clientID and secret via HTTP basic auth header.
    8. Click Next, then click Save

    Screenshot: Account linking

  3. Select the Develop check at the acme of the page, then in the upper veracious hand corner select the Test push button to generate the draft interpretation Test App. If you don ’ deoxythymidine monophosphate see this option, go to the Test tab alternatively, snap on the Settings button in the top correct below the header, and ensure On device testing is enabled ( if it isn ’ metric ton, enable it ) .
  4. Add the google_assistant consolidation shape to your configuration.yaml file and restart Home Assistant following the configuration guide below .
  5. Add services in the Google Home App ( Note that app versions may be slightly different. )

    1. Open the Google Home app.
    2. Click the + button on the top left corner, click Set up device, in the “Set up a device” screen click “Works with Google”. You should have [test] 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.

If you ’ ve added Home Assistant to your phone ’ s home sieve, you have to first remove it from home screen, otherwise, this HTML5 app will show up rather of a browser. Using it would prevent Home Assistant redirecting back to the Google Home app .

Allow Other Users

If you want to allow other family users to control the devices :

  1. Open the project you created in the Actions on Google console.
  2. Click Test on the top of the page, then click Simulator located to the page left, then click the three little dots (more) icon in the upper right corner of the console.
  3. Click Manage user access. This redirects you to the Google Cloud Platform IAM permissions page.
  4. Click ADD at the top of the page.
    1. Enter the email address of the user you want to add.
    2. Click Select a role and choose Project < Viewer.
    3. Click SAVE
    4. Copy and share the Actions project link ( with the new user.
  5. Have the new user open the link with their own Google account, agree to the Terms of Service popup, then select “Start Testing”, select VERSION – Draft in the dropdown, and click “Done”.
  6. Have the new user go to their Google Assistant app to add [test] your app name to their account.

Enable Device Sync

If you want to support active report of state to Google ’ s server ( configuration choice report_state ) and synchronize Home Assistant devices with the Google Home app ( google_assistant.request_sync serve ), you will need to create a service score. It is recommended to set up this configuration key as it besides allows the usage of the follow command, “ Ok Google, sync my devices ”. once you have set up this part, you will need to call this service ( or command ) each clock 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 ) .

  1. Service Account
    1. In the Google Cloud Platform Console, go to the Create Service account key page.
    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. From the Service account list, select CREATE SERVICE ACCOUNT.
    4. In the Service account name field, enter a name.
    5. In the Service account ID field, enter an ID.
    6. From the Role list, select Service Accounts > Service Account Token Creator.
    7. Click CONTINUE and then DONE. You are returned to the service account list, and your new account is shown.
    8. Click the three dots menu under Actions next to your new account, and click Manage keys. You are taken to a Keys page.
    9. Click ADD KEY then Create new key. Leave the key type as JSON and click CREATE. A JSON file that contains your key downloads to your computer.
    10. Use the information in this file or the file directly to add to the service_account key in the configuration.
    11. Click Close.
  2. HomeGraph API
    1. Go to the Google API Console.
    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.

Enable Local Fulfillment

The ssl_certificate option in the http consolidation must not have a measure or this feature won ’ t work .
This is because Google requires a valid certificate and the room it connects to Home Assistant for local fulfillment makes that impossible. Consider using a reversion proxy such as the NGINX SSL accessory alternatively of directing external traffic directly to Home Assistant .

  1. Open the project you created in the Actions on Google console.
  2. Click Develop on the top of the page, then click Actions located in the hamburger menu on the top left.
  3. Upload this Javascript file for both Node and Chrome by clicking the Upload Javascript files button.
  4. Add device scan configuration:
    1. Click + New scan config
    2. Select MDNS
    3. Set mDNS service name to _home-assistant._tcp.local
    4. Click Add field, then under Select a field select name
    5. Enter a new value field set to .*\._home-assistant\._tcp\.local
  5. Check the box Support local query under Add capabilities.
  6. Save your changes.
  7. Either wait for 30 minutes, or restart your connected Google device.
  8. Restart Home Assistant Core.
  9. With a Google Assistant device, try saying “OK Google, sync my devices.” This can be helpful to avoid issues, especially if you are enabling local fulfillment sometime after adding cloud Google Assistant support.

You can debug the setup by following these instructions

YAML Configuration

now add your frame-up to your configuration.yaml file, such as :

 # Example configuration.yaml entry
 google_assistant :
   project_id :  YOUR_PROJECT_ID
   service_account :  ! admit  SERVICE_ACCOUNT.JSON
   report_state :  dependable
   exposed_domains :
     -  switch
     -  light
   entity_config : :
       aliases :
         -  BRIGHT_LIGHTS
         -  ENTRY_LIGHTS
     light.living_room :
       expose :  false
       board :  living room

Configuration Variables

Looking for your configuration file?
project_id drawstring


plan ID from the Actions on Google console ( looks like words-2ab12 )
secure_devices_pin drawstring (


Pin code to say when you want to interact with a dependable device .
service_account map


Service account data. You can use an include statement with your download JSON file, enroll data here directly or use secrets file to populate .
private_key chain


secret key in PEM format

client_email string


Service e-mail address
report_state boolean (


, default: false

actively report card 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 besides required for some features on ocular controls .
expose_by_default boolean (


, default: true

expose devices in all supported domains by default. If exposed_domains domains is set, lone these domains are exposed by default. If expose_by_default is set to false, devices have to be manually exposed in entity_config .
exposed_domains number (


list of entity domains to expose to Google Assistant if expose_by_default is set to true. This has no effect if expose_by_default is set to false .
entity_config map (


Entity specific shape for Google Assistant


entity to configure
name string (


name of the entity to show in Google Assistant
expose boolean (


, default: true

Force an entity to be exposed/excluded .
aliases list (


Aliases that can besides be used to refer to this entity
room chain (


Allows for associating this device to a Room in Google Assistant .

Available domains

presently, the comply 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 percentage/preset mode)
  • light (on/off/brightness/rgb color/color temp)
  • lock
  • 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)
  • humidifier (humidity setting/on/off/mode)

Some of these devices may not display correctly in the Google Home app, such as media_player, however voice commands will still work .

Secure Devices

certain devices are considered dependable, including anything in the lock world, alarm_control_panel world and covers with device types door, garage or gate .
By default these can not be opened by Google Assistant unless a secure_devices_pin is set up. To allow unfold, set the secure_devices_pin to something and you will be prompted to speak the pin when opening the device. close or locking these devices does not require a pin .
For the Alarm Control Panel if a code is set it must be the lapp as the secure_devices_pin. If code_arm_required is set to false the system will arm without prompting for the bowling pin .

Room/Area support

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 .

Climate Operation Modes

There is not an claim 1-1 couple between Home Assistant and Google Assistant for the available operation modes. here are the modes that are presently available :

  • off
  • heat
  • cool
  • heatcool (auto)
  • fan-only
  • dry
  • eco

TV Channels

There is no television receiver channel object in Home Assistant. television receiver groove can only be changed by number, not by name ( for model, Turn to channel two ) .


404 errors on request sync

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. finally, 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 “ ineffective to sync Home Assistant ” ( or whatever you named your undertaking ), this can normally be resolved by going back to your screen app in the Actions on Google comfort and clicking Simulator under 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 equitable hit the enter key for the URL to recreate the Preview .
The request_sync service requires that the initial synchronize from Google includes the agent_user_id. If not, the service will log an erroneousness that reads something like “ Request contains an invalid argument ”. If this happens, then unlink the account from Home Control and relink .
The request_sync serve 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 table. Resolve this by :

  1. Removing your project from the Google Cloud API Console.
  2. Add a new project to the Actions on Google console Here you get a new project_id.
  3. Run through the previously mentioned [Actions on Google console] setup instructions until the step to create a service_account.
  4. Once you begin to create a new service_account in the [Google Cloud API Console], ensure you select the project created in [Actions on Google console] by verifying the project_id.
  5. Enable HomeGraph API to the new project.

Verify that the Google Assistant is available on https://[YOUR HOME ASSISTANT URL:PORT]/api/google_assistant If it is working it should return 405: Method Not Allowed when opened in a browser or via coil .

403 errors on request sync

The request_sync overhaul may fail with a 403 if the HomeGraph API is not enabled. Go to Google API Console and verify that HomeGraph API is enabled for your project .

404 errors on report state

If you receive 404 errors linked to reporting state in your log, Home Assistant is reporting state for entities that were never synced to Google. Ask your Google Home to Sync my devices or run the service google_assistant.request_sync .

Error during linking: “Could not update the setting. Please check your connection”

Your fulfillment URL may be disable or unapproachable. Recheck the Fulfillment URL as specified in Manual Setup and verify that it ’ second publicly approachable .


When using NGINX, ensure that your proxy_pass telephone line does not have a chase /, as this will result in errors. Your line should look like :

proxy_pass http://localhost:8123;

Unlink and relink

If you ’ re having disturb with Account linking failed after you unlinked your service, try clearing the browser history and hoard .

Failed linking – Could not update the setting. Please check your connection

If you ’ re having fuss linking your account, with the error message Could not update the setting. Please check your connection after logging into your Home Assistant example, try setting expose_by_default: false then exposing a individual bare device ( light or switch preferably ). It is besides worth checking if any home ad blocker is disabled if you are having issues .

Help us to improve our documentation

Suggest an edit to this page, or provide/view feedback for this page.

Suggest an edit to this page, or provide/view feedback for this page .

source :
Category : Social

Trả lời

Email của bạn sẽ không được hiển thị công khai.