Links on the site may earn us an affiliate commission. Learn more.

Today, I’m going to show you how to integrate Google Assistant with Home Assistant. So you can control all your Home Assistant entities using your voice from any Google Assistant enabled-speaker. And I’m going to show you how to do it for free.

Ways to integrate Google Assistant

There are 2 ways that you can integrate Google Assistant with Home Assistant. The easiest way is to use the Home Assistant Cloud service. The Cloud service doesn’t only give you access to link Google Assistant but also Amazon Alexa. It also makes it easier to set up remote access for your Home Assistant instance. The cloud service is a subscription plan which costs $5 a month. It’s not a lot for all the benefits that you get. Also, to support the developers that made the Home Assistant project possible, I would recommend, if you can, to support them by subscribing to the Cloud service.

The other way to integrate Google Assistant, which is the method that we will set up today, is free, but it does require a lot more steps to configure. But like always, I’m going to make it simple for you guys, and I’m going to go over everything step-by-step.

Set up new project via Actions on Google

Before setting up everything, you need to have remote access configured in Home Assistant. If you haven’t done that yet, check out my Beginner's Guide to Home Assistant, where I show how to set up remote access using DuckDNS.

  1. To create a new project via the Actions on Google website, go to console.actions.google.com.

  2. Click on New Project, set up a name for it, and click on Create project.

  3. Then, select Smart Home and click on Start Building.

  4. Now that the project is created, under Quick setup, click on Name your Smart Home action and set up a name for it. This would be the name that you would look for when we get to the process of linking the Home Assistant instance to Google Assistant.

  5. Click on Save, and then click on Actions.

  6. Under Fulfillment URL, enter your full DuckDNS URL, including port 443 at the end and also /api/google_assistant.

  7. Click on Save and then click on Account linking.

  8. Under Client ID, you need to enter the following link, [https://oauth-redirect.googleusercontent.com/r](https://oauth-redirect.googleusercontent.com/r/g-asst-integ-for-home-asst), including the project ID at the end. To locate your project ID, click on the Menu icon on the top right, and then click on Project settings. Depending on what you set up as the Project name, sometimes the Project ID could be different or have some extra characters at the end. So, you want to double-check this before you continue with the setup.

  9. To go back to the Account linking, click on Develop, and then enter the following under Client ID, including the Project ID at the end: https://oauth-redirect.googleusercontent.com/r/your-project-id-here

  10. For the Client secret, you can enter anything you would like. This is not a password that Home Assistant would need to link to Google Assistant.

  11. For the Authorization URL, enter your DuckDNS URL and include at the end port 443 and also /auth/authorize.

  12. And for the Token URL, enter the same link but replace authorize with token at the end.

  13. Click on Next and under Use your app for account linking, click on Next as well without changing anything.

  14. Now, under Configure your client, enter email under Scopes and then add another scope and set it to name.

  15. Make sure that the option Google to transmit clientID and secret via HTTP basic auth header is unchecked.

  16. Click on Next and then Save.

  17. The configuration here is now done, so click on Test to activate the new action.

Create a service account in the Google Cloud API

Next, you need to go into the Google Cloud API website and create a service account. This would provide a file with some details that you would need to set up in Home Assistant. So you can sync any changes in the Home Assistant platform with the Google Assistant service.

  1. On another tab, go to https://console.cloud.google.com/apis.
  2. Click on Select a project and click on the project created via the Actions on Google website.
  3. Then, go into Credentials, click on Create Credentials, and select Service account.
  4. Set up a Name for this service, which would then be added as a service account ID. You can also add a description for this service if you would like. However, it’s not needed.
  5. Click on Create.
  6. Then, under Grant this service account access to project, click on the drop-down and select Service Accounts > Service Account Token Creator.
  7. Click on Continue and then click on Done.

Download the JSON file for the Service account

All right, so the Service account is now created. To download the file that we would need, go into:

  1. Manage service accounts.
  2. Then, click on the More options icon on the right side of the created service and click on Create key.
  3. On the pop up that comes up, click on JSON for the Key type.
  4. Then click on Create.

Enable the HomeGraph API

Before setting the Google Assistant integration in Home Assistant, you need to enable the HomeGraph API in the Google Cloud Platform.

  1. Go to the sidebar, and under API & Services, click on Library.
  2. Then search for HomeGraph API, open it.
  3. Click on Enable.

Configure the Google Assistant integration in Home Assistant

We’re done with the configuration on the Google side. Which pretty much was the hard part. Next, you need to configure the Google Assistant integration in Home Assistant. You could add all the settings inside the Configuration.yaml file. However, to make everything nice and neat, create a separate file, and add the Google Assistant configuration in there.

  1. Using a code editor like VS Code, open the Home Assistant Config folder and create a file named, for example, google_assistant_integ.yaml.
  2. Then, open the configuration.yaml file and enter the following:
google_assistant: !include google_assistant_integ.yaml
  1. Save the changes to the configurarion.yaml file.
  2. Then, open the Google Assistant integration file and enter the following:
project_id: 
service_account:
  private_key: 
  client_email: 
  1. Then open the JSON file, downloaded from the Google Cloud Platform.
  2. Copy the project_id, the private_key, and the client_email and paste it into the Google Assistant integration file.
  3. Next, enter report_state: and set it to true. Like that, Google Assistant is updated with any state changes in your Home Assistant entities.
  4. Lastly, enter exposed_domains: and add the domains from Home Assistant that you would like to expose to Google Assistant.
report_state: true
exposed_domains:
  - switch
  - light
  - sensor
  - script
  1. At this point, we pretty much have the basic setup required, so save the file and then restart Home Assistant to apply the changes.

After the Google Assistant integration is configured, you need to Link Home Assistant in the Google Home app.

  1. Open the Google Home app on a mobile device and tap on the plus “+” icon on the top left.
  2. Then, tap on Set up device > Have something already set up?
  3. And then search for the name of the project you created via Actions on Google. Your project will show up with a cloud icon and the word [test] at the beginning.
  4. Tap on your project, and you should get the Home Assistant login screen.
  5. Sign in to your Home Assistant.
  6. When the linking is completed, another page comes up to assign your Home Assistant entities to rooms.
  7. When you finish, tap on Done and then Finish setup.

And that’s about it. Your Home Assistant entities are available now via Google Assistant, and you can easily control them with your voice.

Disable entities from being exposed to Google Assistant

If you have entities that you don’t want to control with Google Assistant, you can easily disable them, so they are not exposed. To do that, go back into the Google Assistant integration file.

  1. Add entity_config:
  2. Enter the name of the entity that you would like to configure.
  3. Below it, type expose: and set it to false.
  4. When you are done, save the file, restart Home Assistant.
  5. Then from Google Assistant, run the command, “Hey Google! Sync my devices”. Google Assistant will then resync and apply the changes made in Home Assistant. You would then noticed that the device blocked from being exposed would be removed.

Other options that you can add to the entity_config is aliases, which you can use to add different aliases that will refer to a specific entity, and also room, which is used to specify the room that the entity belongs to. And then again, when you are finished editing the file, save it, restart Home Assistant and run the command via Google Assistant to sync the devices.

Reenable the Actions on Google Test environment

There is one important thing that I want to mention. The Actions on Google project that we created to make this possible is in a testing environment. So after 30 days, the test expires. However, you can still control your devices via Google Assistant with no problem. The part that you’re going to run into an issue is if you make changes to your home assistant, and you try to sync your devices in Google Assistant. You would get an error message that it was unable to sync with your Home Assistant project. The good news is that you can quickly fix that by reenabling the test simulation. To do that, go back to the Actions on Google website

  1. Open your project
  2. Then click on Develop
  3. Account linking
  4. And click on Test.

And that’s about it. When you run the command via Google Assistant to sync your devices, you won’t get an error message anymore, and any changes in your Home Assistant will sync with Google Assistant.

Want to support my work?