The Home Assistant Beginner’s Guide Part 3: Integrating Home Assistant with the Google Assistant/Google Home

Disclosure: This post contains affiliate links. If you click through and make a purchase, I will earn a commission, at no additional cost to you. Read my full disclosure here.

A smart speaker with a brain.
Update: May 31, 2019

Google Home is now Google Nest

Since my fingers first hit the keyboard for this piece, the Google Home line-up has given way to the Google Nest range. Currently, we're talking about the Nest Audio and Nest Mini. However, both are still powered by the same trusty Google Assistant found on the original Google Home devices. I've tweaked this beginner's guide to reflect these updates.

But let's be clear, this integration isn't just about turning your smart speaker into a Home Assistant sidekick. Google Assistant is sprouting up everywhere, expanding its footprint by the day. From your trusty smartphone, to wristwatches, security cams, and even car dashboards, Google Assistant is popping up like mushrooms after a rainstorm. It just so happens that Google Home was the pioneer that first introduced Google Assistant to our humble abodes.

Welcome back, home automation enthusiasts! As we dive into the third installment of our Home Assistant Beginner's Guide, we're tackling the exciting task of syncing your Home Assistant with Google Assistant, which encompasses devices like Google's Nest Mini, Nest Audio, Nest Hub, and Pixel smartphones. By the end of this guide, you'll be commanding your Google Assistant to adjust lights to your preferred hue and control various devices connected to Home Assistant.

Contents

Integration without a Nabu Casa subscription

This guide will walk you through integrating Home Assistant with Google Assistant, sans the assistance of Nabu Casa. While subscribing to Nabu Casa simplifies the process and supports Home Assistant's future development, I've chosen the more hands-on approach, managing several services alongside Home Assistant on my server. However, if you decide to support through Nabu Casa, you're contributing to a worthy cause.

But be warned, this part of the Home Assistant Beginner's Guide may be the most challenging yet. It involves a fair amount of coding and handling multiple tools. But don't worry, I'll simplify it as much as possible. We're all beginners here!

Clarifying the confusion: Google Home, Google Nest, and Google Assistant

Before we jump into the guide, let's clear up some common confusions. When referring to Nest Audio or Nest Mini, I'm talking about the hardware—the physical smart speakers in your home. Google Assistant, on the other hand, is the software brain behind these devices, powering their capabilities. These terms are often used interchangeably, sometimes even by Google, which can lead to confusion. Lastly, Google Home is the overarching home automation service from Google, with apps available for your smartphone, smartwatch, smart speakers, and smart displays.

What You Need to Get Started

Before you begin pairing your Google Assistant with Home Assistant, there are a few essentials you'll need:

By ensuring you have these items ready, you'll be well on your way to a successful integration of your Google Assistant with Home Assistant.

Getting started with gactions CLI

Your first port of call is downloading the gactions CLI — this is the command line interface that you'll use to test and update your integration.

A screenshot of the download page for the gactions CLI, offering options for Windows, macOS, and Linux.

Once you've downloaded the correct version for your operating system (most likely x86_64), copy the file into a new, empty folder. In that same folder, create a text file and rename it 'project.json' (be sure to enable 'file name extensions' in Windows Explorer, or you'll end up with a file named 'project.json.txt').

Open the file with Visual Studio Code, and populate it with the following code, replacing the URL with the one you set up with Duck DNS:

{
  "actions": [{
    "name": "actions.devices",
    "deviceControl": {},
    "fulfillment": {
      "conversationName": "automation"
    }
  }],
  "conversations": {
    "automation": {
      "name": "automation",
      "url": "https://[YOUR HOME ASSISTANT URL]/api/google_assistant"
    }
  }
}

Setting up a new project in Actions on Google

Head over to the Actions on Google developer console and start a new project. Choose a project name and your country, then hit 'create project'. You'll be greeted by a lot of jargon that might as well be in another language. Don't worry, we're only interested in the 'Actions SDK'. Click on 'Build'.

A screenshot of the Actions on Google website, prompting the user to add or import a project.
A screenshot of the Actions on Google website, showing how a new project with the name “Home Assistant” is created.
Screenshot of the Actions on Google dashboard with options to create and publish an app for the Google Assistant. The main part of the screen shows three sections: 'Dialogflow' with a tagline to use a simple speech interaction builder, 'Smart home' to build an app that lets users control IoT devices, and 'Actions SDK' for setting up a Software Development Kit. Each section includes a 'Learn more' link and a 'BUILD' button. The background features a muted graphic of a smart display interface.
A screenshot of the Actions on Google website showing instructions on how to use the Actions SDK for an Assistant App.

Copy the code ('$ gactions update…') and paste it into an empty notepad – we'll need that later. In the notepad, replace 'PACKAGE_NAME' with project.json and replace the '$' with './' if you're using Windows.

Here's what your code should look like on a Windows machine:

./gactions update --action_package project.json --PROJECT_NAME
Screenshot of a computer's file explorer window with a context menu open. The context menu is displaying options including 'Open PowerShell window here.' Two files are listed in the explorer: 'gactions.exe,' an application file, and 'project.json,' a JSON file. The 'gactions.exe' file is highlighted, indicating it was right-clicked to open the context menu. File details such as 'Date modified,' 'Type,' and 'Size' are visible for both files.
Beginners Guide Part 3 Aog 06
Screenshot of a Google authorization page with the Google logo at the top. It welcomes a user to an application with blurred out details. The app, 'Assistant CLI,' is requesting permission to 'View and manage your Actions on Google.' There are two options at the bottom: 'CANCEL' and 'ALLOW,' with 'ALLOW' highlighted in blue.
A blurred image of a text instruction asking to copy a code, switch to another application, and paste it there.
Screenshot of a computer screen displaying a message indicating success in updating an app. The message prompts the user to enter an authorization code and informs them that their app for the project 'home-assistant-26294' has been updated with their actions. It includes a URL to visit the Actions on Google console for final registration and review of the app.

Open the copied URL in a browser and fill in the required 'App information'. Once Google is satisfied with the details you've provided, click save. Next, click on 'back', select 'Account linking', and click on 'Edit'. Fill in the necessary information, and when prompted, select the implicit grant type. For the 'Client ID', you're going to need a long, random, and secure string. You could use something like the Random Password Generator for this – just make sure to select the maximum length.

Beginners Guide Part 3 Aog 10
Beginners Guide Part 3 Aog 11
Screenshot of an app development interface titled 'Home Assistant' with a blue and white theme. There are three sections visible: 'Actions' with a checkmark indicating 'Smart home actions in English' are completed, 'App information' with a checkmark noting 'Incomplete app information in English', and a numbered '3' next to 'Account linking' without a checkmark. Two buttons are present, 'TEST DRAFT' on the left in gray and 'SUBMIT DRAFT FOR REVIEW' on the right in blue. The 'Home Assistant' has a circular icon with a stylized house and foliage.
Screenshot of a web interface for configuring a client application. The section displayed is titled 'Client information' with fields for 'Client ID' and 'Authorization URL', the latter pre-filled with a URL beginning with 'https://****.duckdns.org/api/google_assistant'. Below this section is a 'Next' button, and at the top, a 'Grant type' section is partially visible, checked off as 'Implicit'. At the bottom, there are checkboxes for 'Configure your client' (checked) and 'Testing instructions' (unchecked), with 'Back', 'Cancel', and 'Save' buttons available.

Save this string in a notepad, we'll need it later. The 'Authorization URL' should be your Home Assistant URL, plus '/api/google_assistant/auth': https://YOUR_HOME_ASSISTANT_URL.duckdns.org/api/google_assistant/auth

Beginners Guide Part 3 Aog 14
A screenshot prompting the user to test the draft.
A screenshot of the Google Cloud Platform showing the project name the user has chosen, Home Assistant, and the Project ID, which is obscured in the screenshot.

Giving your Home Assistant the HomeGraph API power-up

While this isn't a must-do, it's a step that's sure to make your life easier, and who doesn't want that? With the help of the HomeGraph API, your Google Assistant will be able to keep up with the latest updates on your tech terrain. Just tell it to “sync my devices”, and it'll align your Home Assistant devices with itself every time you bring a new gadget to the team or tweak an existing one. So, let's get to it. Here's how you can activate this helpful feature:

  1. First things first, head over to the Google Cloud Platform.
  2. Pick your project from the list and hit the ENABLE button.
  3. Once that's done, click MANAGE. In the menu on the left, you'll find Credentials. Click on that and then on Create credentials. From the drop-down menu, select API key.
  4. Voilà! You now have a new API key on the list. Grab it and copy it to your notepad.
Beginners Guide Part 3 Aog 17
A screenshot of the Google Cloud Platform showing the option to create API keys.

Tuning up your Home Assistant

Keep your notepad at arm's reach and pull up the configuration.yaml. Here's where you'll need to conjure up another unique string for your access_token. Tweak the following code with your info, and then give your Home Assistant a quick restart from the Web UI. Be patient until it's fully booted:

google_assistant:
  project_id: ACTIONS_ON_GOOGLE_PROJECT_NAME
  client_id: CLIENT_ID_CREATED_DURING_SETUP
  access_token: RANDOM_STRING
  agent_user_id: EMAIL_ENTERED_DURING_SETUP
  api_key: HOMEGRAPH_API_KEY_CREATED_DURING_SETUP
  exposed_domains:
    - switch
    - light
    - group

Welcoming Home Assistant to the Google Home app

Now, grab your smartphone and fire up the Google Home app. Make your way to Home control (it's hiding in the menu). Tap the big + button to add new devices (in this case, our friend, the Home Assistant). The project you've just created will be sitting at the top of the list, sporting a [test] badge. Add the device and watch as all your devices set up in Home Assistant make their grand entrance!

A screenshot of the Google Home App showing a list of connected devices, including a Nest Mini, Nest Audio, and Android TV television.
A screenshot of the Google Home app showing the Home Assistant integration in a list of available integrations.
A screenshot of a list of devices available in the Google Home app through the Home Assistant integration.
A portrait photo oif Liam Alexander Colman, the author, creator, and owner of Home Assistant Guide wearing a suit.

About Liam Alexander Colman

is an experienced Home Assistant user who has been utilizing the platform for a variety of projects over an extended period. His journey began with a Raspberry Pi, which quickly grew to three Raspberry Pis and eventually a full-fledged server. Liam's current operating system of choice is Unraid, with Home Assistant comfortably running in a Docker container.
With a deep understanding of the intricacies of Home Assistant, Liam has an impressive setup, consisting of various Zigbee devices, and seamless integrations with existing products such as his Android TV box. For those interested in learning more about Liam's experience with Home Assistant, he shares his insights on how he first started using the platform and his subsequent journey.

Comments

  1. On the Google Cloud Platform- Homegraph API- Create Credentiials I only get these options:
    OAuth Client ID
    Service Account
    Help Me Choose

    I do not see API Key.
    Am I doing something wrong?

    Reply

Leave a comment

Share to...