Get more out of your smart home with Google Home API

Table Of Contents

IoT is a great opportunity for developers and smart home passionates, wanting to learn how to use electronics in a hands-on way. According to IoT enthusiast Orestes Carracedo: “If you’re a creative developer or a creative person you can do whatever you want to do with electronics. If you’ve never gotten started with electronics, there’s a bunch of kits that you can buy for Arduino and for other open hardware platforms. They are very, very cheap nowadays.”

Orestes Carracedo is the co-founder of Lighthorse Consulting and an enthusiastic IoT hacker. He’s also a consultant, speaker, mentor, and community lead and co-organiser of GDG Vigo and the Community Cluster. At Codemotion Madrid last year he took a deep dive through all the pieces you’ll need to integrate your nifty gadgets with the Google Assistant. He also provided a couple of great demos. This is a basic overview of the tutorial detailed in Orestes’ talk. For the full tutorial and discussion, take a look at the video below:

[jwp-video n=”1"]

Understanding the Google Smart Home API

Google Home is structured in three main components:

  • Google Home/Mobile Device — the surface to interact with the Assistant
  • The Google Assistant — a conversation between you and Google that helps you get things done in your world
  • Actions on Google — How developers can extend the ecosystem

In the following, we’ll try to understand how such components are used together to form the whole user experience we’re used to when chatting with Google Assistant.

Smart Home API: Standard devices and traits

How do you trust the user voice? How do you understand user voice? How do you extract intent? What do they want to do? So for that we have the Google Platform.

So the Smart Home API knows how about pretty much anything you can think of at the device. You have definitions for starting and stopping, turning on off, changing colour settings with different colour schemes, changing brightness, speed, etc. You can do pretty much whatever!

Home Graph

Smart Home Actions rely on Home Graph, a database that stores and provides contextual data about the home and its devices. The Home Graph database stores information about structures (for example, home or office), rooms (for example, bedroom or living room), and devices (for example speaker and light bulb). For example, Home Graph can store the concept of a home with a living room that contains multiple types of devices from different manufacturers such as a light, television, and speaker. This information is available to Google Assistant in order to execute user requests based on the appropriate context. State data, such as if a light bulb is on, is not stored in the long term — it’s ephemeral and is only used in the Home Graph.

Home Graph is essentially a logical map of your home. It allows you to have a natural conversation with Google Assistant. If you are sitting in the den and you want to turn the den lights off, you would just say Hey Google, turn off the lights and would not mention the room that you are currently in.

Smart home provider UI components

The UI components available using this platform are two:

  • User registration and authentication (based on Firebase)
  • Device management, allowing you to add additional labels (e..g adding another door, adding another camera, etc.) This usually needs to be configured on a web interface

Voice User Interface platform for the Google Assistant

Let’s see how can we setup our Actions on a Google Project.

First, navigate to From here, log in with your Google Account and then create new Actions on Google Project. Pick any project name you want. You can select any support language.

Setup Google Smart Home API actions

If you get the following screen, click on SKIP on the top right:

Setup Google Smart Home API actions

Make sure you pick the Smart Home template, shown below:

Setup you smart home control

Pick a display name. This will be displayed in your list of Smart Home providers in the Google Home app.

Setup Google Smart Home API actions

Go to the list of actions and click on the only action that shows on the list

In the settings for the action, enter the endpoint URI for your request Firebase Cloud Function:

Create Smart Home actions

Now go the Advanced Options > Account Linking page and select the following options:

Google API: account linking

You can enter any client ID and client secret you want, while for the Authorization URL, use the URL that the Firebase Hosting provided you with Fore the Token

You’re done creating your smart home functionalities!

Now you can ask the Google Assistant to

  • Turn on the light
  • Turn off the light
  • Set the light to green
  • Set the light to 50%

You should see the logs in the Serial Monitor and your RGB light following your commands.

Looking for more IoT tutorials?

There’s a plethora of great IoT tools and tutorials available to get you started.


If you are interested, check out some of them in our Codemotion Magazine:

Finally, don’t miss the opportunity to attend our Codemotion Online Tech Conference, starting tomorrow! There is still room for attendance: get your ticket now!

You can read the orginal version of this article at, where you will find more related contents.




We help tech communities to grow worldwide, providing top-notch tools and unparalleled networking opportunities.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Laravel 7.x Notification Tutorial | Create Database Notification with Laravel

Object-Oriented Programming

FlexBox and CSS Grid

GUI Container In Docker — Task 2

Cofigure a Kubernetes cluster using Ansible.

Keeping an ordered collection in PostgreSQL

My fourth week with OpenMRS

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


We help tech communities to grow worldwide, providing top-notch tools and unparalleled networking opportunities.

More from Medium

How timely migration can save your money?

APPNOLOGY 101, PART 3: “Symmetry”

How We Built LYST Website Clone in just 7 days?

Debug events in Event Bridge