Integrate Home Assistant with Google Home
In this tutorial, I will walk through how you can integrate Home Assistant with Google Home.
Before you can proceed any further, please ensure your Home Assistant can be externally accessible. Follow my tutorial below, how you can use DuckDNS to make access the Home Assistant remotely.
Setting Up DuckDNS in Home-Assistant.IO
This quick tutorial lets you walkthrough how to setup the DuckDNS in your Home Assistant.IO.
Google Console Configuration
Go to Actions on Google console and create a new project (e.g., Smart Home)
And select Smart Home and click Start Building.
On this screen, select Name your Smart Home action.
On the Develop tab > Display name, select the name you wish (e.g., Home Assistant).
Select Develop tab and insert the Fulfilment URL with https://[YOUR HOME ASSISTANT URL:PORT]/api/google_assistant
Click Project Settings.
Give a project a name for example Smart Home and note the Project ID.
Select Overview tab and click Setup account linking.
On the OAuth Client Information,
- Enter Client ID: https://oauth-redirect.googleusercontent.com/r/<project_id>
- Enter Client Secret: any character you wish.
- Enter Authorization URL: https://[YOUR HOME ASSISTANT URL:PORT]/auth/authorize
- Enter Token URL: https://[YOUR HOME ASSISTANT URL:PORT]/auth/token
On the Configurate your client (optional), add scope email and name and click Next.
Select Develop tab and click Test button.
Check if the test is successful.
Now go to https://console.cloud.google.com/ and select APIs and services > Credentials.
Click Create Credentials > Service account.
Give a name of service account and click Create and Continue.
Select a role Service Accounts > Service Account Token Creator under Grant his service account access to the project.
The role should be Service Account Token Creator as shown below.
Click Done to continue.
Select the Service Account you created and click the pencil icon to edit.
Select Keys tab and click Add Key.
Select Create new key.
Select key type JSON to create private key for your project.
The private key will be automatically downloaded to local computer. We will use later the configuration in this file in Home Assistant.
Search for HomeGraph API.
And enable it.
That’s all the steps required in the Google console.
Home Assistant Setup
Now move on to Home Assistant and open the configuration.yaml in the config folder.
Insert the following lines:
service_account: !include SERVICE_ACCOUNT.json
Replace the <project_id> with the project ID you created in the earlier step.
Create SERVICE_ACCOUNT.json in config folder and insert the content with the private key you have downloaded in the earlier step.
That’s all that we need to do in Home Assistant. Now let’s restart the Home Assistant.
Open your Google Home app on your mobile phone and search for Home Assistant and click it.
Logon to your Home Assistant.
And you will see the devices configuration listed in your Home Assistant from Google Home.
That’s all that you need.