Integrate for free Google Home (Assistant) with Home Assistant (via GCP)

8 minutes of reading
Guide purposes:
Concepts dealt with:
  • Software configuration
Software components used:
Prerequisites:
  • Home Assistant configured and working (minimum 0.62 version)
  • Home Assistant remote via HTTPS (explained later)
  • Google Home/ Assistant configured and working and its associated Google account
  • A personal Google account (linked to proprio /propri Amazon Echo)
Physical devices used:
  • The computer on which it is running Home Assistant
  • Smartphone and / or tablet on which to run theapp "Google Home"(Android and / or iOS)
  • Google Home/ Assistant (any model of smart speaker or appsoftware that you use Google Assistant as integrated software)
GUIDE more indicated for:

All environments

Notes and disclaimer
  • qualsiasi eventuale modifica agli impianti domestici dev'essere progettata ed realizzata SOLO da personale qualificato;
  • any changes implemented in probefore is a propersonal responsibility as well as a profirst risk and danger (the contents of the present page are purely educational);
  • any changes implemented in proprior to a device it voids the guarantee, quality approvals and certifications.
Driving review: 2.0

Google Home  -  Home Assistant

Abstract

The advent on the market of Smart Speaker is slowly changing the habits of many who, everydaynamente, they become familiar and familiar with the possibility of interacting with a real e profirst personal assistant simply using voice and natural language.

Google Home It is one of device of wider and more recognized success. As we explained, this smart speaker uses the software to work Google Assistant, which is available, even for smart speakers proproduced by third parties, as well as how appstand-alone communication for Android and iOS smartphones / tablets.

Any smart speaker you use Google Assistant can be easily integrated with Home Assistant. But why, since many domotic components declare compatibility with Google Home - and therefore can be controlled "by factory" by such Smart Speaker - it is useful to integrate them with the latter Home Assistant? [Before answering the question, who reads have clear the concept of integration in home automation.]

Simple: why through a personale HUB like Home Assistant we are able to define scenarios, virtual accessories, automations otherwise not definable with the separate use of the single components. As explained also in a episode of our podcast, some simply evolved scenarios they cannot be realized without the aid of a common platform, or a personale HUB.

The moment it integrates itself like this personal HUB(therefore Home Assistant in the specific case of this guide) with Google Home, you can check all the components and the entity - which scenarios (and others) - defined in it through my personal assistant. One of the many reasons to adopt a personale HUB for the profirst home automation.

A focus on this important topic is available here.

The elements (defined of) defined in the configuration Home Assistant and controllable through integration with Google Assistant (Google Home and compatible speakers, as well app) I'm:

N.b. To integrate Google Assistant with Home Assistant exist two roads:

This guide shows you how to make the second chance, the free one.

Finally, it is good to know that Google Home can be integrated to Home Assistant also how to repromultimedia producer and how voice notification system, or "making him speak" automatically when certain conditions arise in home automation.

It starts

Prerequisites

As shown above, the main pre-requisites they are two:

  • version of Home Assistant greater than or equal to 0.62;
  • Home Assistant configured for remote control via HTTPS.

The second point is that the proinstance Home Assistant is reachable remotely and by proHTTPS tocol. In case you are using Home Assistant installed on Raspberry (installation as applicativo) it's available a detailed guide to prosubsidence.

Finally, it is (obviously) necessary that su Home Assistant no is operational paid integration via Nabu Casa.
If necessary, deactivate it before to begin with the execution of this guide.

Prosubsidence

The integration it is not particularly complex, but provides for the timely compliance of some sequential actions, substantially four:

  1. definition of a propersonal jet at Google Actions;
  2. definition of a key Service Account Key presso Google Cloud Platform;
  3. configuration Home Assistant;
  4. entity discovery Home Assistant controllable via Google Echo / Assistant.

Projet Google Actions

"Google Actions"Is a web operating environment (rib of Google Cloud Platform, Google's cloud environment for developers - and not) which allows anyone to create procastings designed to expand the functionalities of Google Assistant.

To implement the integration described in this guide we will use a specific typology of procast: "Smart Home". Let us therefore go to Google Actions and, after authenticating and accepting the terms of use (unless previously done), select new projet:

Google Actions - New project

Once clicked, indicate as a name projet "Home Assistant”(Or another name of your preference) and select language and nationality:

Google Actions - New project - Name

At this point click on "Create procast ”and move forward.
You will be asked by the site to choose the typology of the new projet, I our case "Smart Home"

Google Actions - New project - Tipology

will then be asked which sub-typology of procast create, choose again "Smart Home"

Google Actions - New project - Tipology 2

Completed this first part of procedura will end up on the dashboard of projet appena created. To complete the creation of the Action it is necessary to complete a whole series of cards.

First, it is necessary to set a "name" to ours Action: to do so, we will click on "Name your Smart Home action"(May vary based on language translation):

Google Actions  -  Project Dashboard - Name your project

The name we are going to indicate rappwill resent theaction at theapp Google Assistant, therefore it is good to give it a sufficiently clear name. It is not possible to use compound names that contain the word "Assistant"

Nb In this phase it is possible to indicate several different languages, if needed.

Google Actions  -  Project Dashboard - Name your project 2

After clicking "salvo"You can return to the tab"Overview" for prosee the second step, that is, that of “Setup account linking"

Google Actions  -  Project Dashboard - Setup account linkingIn this phase it goes to indicate to theAction what are the coordinates to our instance Home Assistant. First of all, we will specify the desire to simply "connect" a profirst web site atAction:

Google Actions  -  Project Dashboard - Setup account linking 2

Clicking "Next"We will go further, or to define the type of link, where we will choose"OAuth"For the first entry and"Authorization Code"For the second:

Google Actions  -  Project Dashboard - Setup account linking 3

At the new pressure of “Next"The client information will be entered"OAuth"

Google Actions  -  Project Dashboard - Setup account linking 4

In the fields, fill in as follows:

  • Client ID: https://oauth-redirect.googleusercontent.com/
  • Client secret: a random string of your choice
  • Authorization URL: https://VOSTRO_INDIRIZZO_HOME_ASSISTANT: DOOR/ Auth / authorize

example: https://casamia.duckdns.org:8123/auth/authorize

  • Token URL: https://VOSTRO_INDIRIZZO_HOME_ASSISTANT: DOOR/ Auth / token

example: https://casamia.duckdns.org:8123/auth/token

Click therefore "Next”To move to the fourth point, where the profirst client:

Google Actions  -  Project Dashboard - Setup account linking 5

Add twoScope", Indicating in the first field"e-mail"And in the second"name". Finally click on "Next”To move to the fifth and final step, or test:

Google Actions  -  Project Dashboard - Setup account linking 6

Insert in the text field "test tank"And finally click on"Save"To return to the dashboard by clicking on"Overview". Once this point is reached, go to the "Build your Action"Which follows"Quick setup". To select "Add Action (s)"

Google Actions  -  Project Dashboard - Build Your Action - Add action

In the finestthat will open, indicate in the field:

  • Fullfillment URL: https://VOSTRO_INDIRIZZO_HOME_ASSISTANT: DOOR/ Api / google_assistant

example: https://casamia.duckdns.org:8123/api/google_assistant

Click on "Save"To return to the dashboard by clicking on"Overview"
At this point it will be possible to click on “Enter information required for listing your Action in the Actions directory"

Google Actions  -  Project Dashboard - Build Your Action - Get ready for deployment

Nb We are not really going to make this public "Action", But we will leave it in draft, or in tests, so to speak.

In the following screen (item "Deploy") We will indicate the contact information related to the Action, although it will remain private:

Google Actions - New project - Deploy

In the entry "Description", Indicate a short description and a long description (of any texts):

Google Actions - New project - Deploy 2

Under the heading "Pictures"Indicate an icon (for example the logo of Home Assistant):

Google Actions - New project - Deploy 3

Under the heading "Contact details"Indicate the profirst data (at least the email):

Google Actions - New project - Deploy 4

Finally, under the heading "Privacy and consent"Indicate the address https://home-assistant.io in both fields:

Google Actions - New project - Deploy 5

Ignore the last entry, "Additional Informations", And click on"Save" top right.
At this point, click on "Test”To open the finestof the simulator:

Google Actions - New project - Test

Click on the bottom left, under "Talk to ..."
The finestra will report an error, but it is normal: don't give it weight.

Concluding the activities at Google Actions, recover the "Project ID"Clicking on the top three dots and then"Project settings"

Google Actions - New project - Project Settings

Once the finestout, appuntarsi the value of the ID of projet indicated in the field Project ID:

Google Actions - New project - Project Settings 2

Finally close the finestbrowser.

Service Account Key

Now is the time to generate a "Service Account Key", An authorization key needed later in the configuration of Home Assistant.

To do this, it is necessary to connect, always authenticating with proyour Google account, at this address.

In the form that appto the vice "Service account"You need to select"New service account"

Google Actions - New service account - step 1

Under the heading "Service account name" to insert "homeassistant", While under" Role "select"Project">"Owner"

Google Actions - New service account - step 2

Finally select “JSON"And click on"Create"
The browser, after a short wait, there prowill download a file with an extension .json. Save it aside, it will serve shortly.

Configuration Home Assistant

It's time to act presso Home Assistant. To activate the integration of Google Home, in fact, it is necessary to add in configuration a small block that providesHUB the coordinates with respect to:

  • the ID of projet defined with proprio procast at Google Action;
  • la Service Account Key defined at Google Cloud Platform;
  • the domains to be displayed towards Google Assistant.

As mentioned in the abstract, the domains (ie the typology) of entities that can be controlled by Google Assistant I'm:

  • binary sensors (binary sensors)
  • chamber (IP cameras)
  • climate (air conditioners and thermostats)
  • cover (Dark)
  • fan (fans) - on / off
  • group (Groups)
  • boolean input (boolean input)
  • and "light", too (Lights)
  • media_player (repromultimedia producers)
  • scenes
  • script - activation / activation only
  • sensor (sensors, temperature only)
  • Switch (switches)
  • vacuum (vacuum cleaner)

It is therefore necessary to indicate, one by one, the domains to be displayed by Home Assistant to Google Assistant; our warm advice (especially in the presence of a particularly articulated personal domotics) is to start by degrees, indicating one domain at a time, so as to have the opportunity to administer the various entities at Google Assistant in an orderly way.

To activate the integration, the “type” block to be inserted in the configuration is:

google_assistant:
  project_id: XXXXXXX
  service_account: !include YYYYYYY
  exposed_domains:
    - light

In the example we have indicated only one domain, "Light"; how easy to guess, the fields "project_id" and "service_account”Are to be filled in with the information previously collected relating to theID of procast Google Action and Service Account Key of Google Cloud Platform.

As for the field service_account, it is necessary to indicate, instead of “YYYYYYY”Of the example, the name of the downloaded file in the step in which the Service Account Key was defined. Finally, this file must be copied to the directory containing i configuration file di Home Assistant (Eg. / Config / in the case of HASSIO, /home/homeassistant/.homeassistant/ in the case of installation on Raspbian and so on).

Once that setup is complete, restart Home Assistant.

AUTO DISCOVERY

Recommended but not mandatory, an automation that, when starting Home Assistant, indicate toHUB to automatically switch to Google Assistant any new entity (of the types included in the domains indicated in the configuration), without the need to ask a Google Assistant to do it forcibly.

In first it is necessary to recover the proprio user ID presso Home Assistant, which is available from "Settings">"users”And selecting the profirst user:

Home Assistant - User ID

Once the ID is obtained, add the following automation:

automation:
 alias: Google Assistant Sync
  trigger:
  - event: start
    platform: homeassistant
  condition: []
  action:
  - service: google_assistant.request_sync
    data:
      agent_user_id: MIO_USER_ID
Taking care to indicate, at the camp agent_user_id il proFirst ID previously recovered.

Add the Action a Google Home

This is the final step aimed at adding our "Action" to our ecosystem Google Assistant.

After waiting for the reboot of Home Assistant, open theapp Google Home (For Android and / or iOS) taking care to be authenticated with profirst Google account.

Once inside, click on "+"

Google Home - Add device

Next, select the item "+"

Google Home - Add device  2

Then, the first item:

Google Home - Add device  3

At this point it will be necessary to choose the propria "Action“, Which name will vary based on the choices made at the beginning of its definition at Google Actions (I our case, "abra cadabra"

Google Home - Add device  4

Obviously the prefix "[Test]"Is more than normal, since ours"Action"Is private and not public.
Once the "Action”Authentication will be requested to il proprio Home Assistant:

Google Home - Add device  5

Once authenticated, if everything works correctly, Google Home show all the entities of the type of domains indicated in the configuration.

It will therefore be sufficient complete the configuration of the individual entities (in this example the only lights, since as domains included in the integration we have indicated only "Light"):

Google Home - Add device  6Once this activity is completed, the integration will be completed and it will therefore be possible to begin to control the profirst home automation based on Home Assistant via voice commands at Google Home/ Assistant.

"Make people talk" Amazon Alexa as a home automation notification system on Home Assistant