• Skip to primary navigation
  • Skip to main content
  • Skip to footer

Codemotion Magazine

We code the future. Together

  • Discover
    • Events
    • Community
    • Partners
    • Become a partner
    • Hackathons
  • Magazine
    • Backend
    • Frontend
    • AI/ML
    • DevOps
    • Dev Life
    • Soft Skills
    • Infographics
  • Talent
    • Discover Talent
    • Jobs
    • Manifesto
  • Companies
  • For Business
    • EN
    • IT
    • ES
  • Sign in
ads

Cate LawrenceOctober 19, 2020

Get More Out of Your Smart Home with Google Home API

Events
google-home
facebooktwitterlinkedinreddit
Table Of Contents
  1. Understanding the Google Smart Home API
  2. Smart Home API: Standard devices and traits
  3. Home Graph
  4. Smart home provider UI components
  5. Voice User Interface platform for the Google Assistant
  6. Looking for more IoT tutorials?
  7. Want to launch a developer event despite the challenges of COVID-19?

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 VigoTech.org 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.

Recommended article
Anatomy of a Successful Talk Proposal: Tips from Codemotion's Technical Committee
February 17, 2025

Anatomy of a Successful Talk Proposal: Tips from Codemotion’s Technical Committee

Luca Fregoso

Luca Fregoso

Events

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:

Loading the player...

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 https://actions.google.com. 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.

IoT

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

  • Controlling Drones with Javascript
  • Tweet my Wedding dress

We also have our upcoming Codemotion Conference. We’ll gather all IT professionals with different backgrounds and levels of experience providing them with technical excellence, cutting-edge technologies as well as hands-on activities, best practices & case studies.

Want to launch a developer event despite the challenges of COVID-19?

If you want to know more about how modern technologies and tools can support you for – and during – the organisation of a virtual event, don’t miss this article showcasing the best tools we used to host our online conferences since the COVID-19 outbreak.

Related Posts

CSS Creator Håkon Wium Lie at Codemotion Milan!

Codemotion
July 13, 2023

Don’t Miss Codemotion’s First Devs Book Club With Michele Riva!

Codemotion
March 4, 2022
entrepeneur

Scott Chacon: Chatterbug CEO Talks About His Accidental Entrepreneurship Journey

Lorenzo Ermigiotti
December 22, 2020
mobile developer, mobile or web. sviluppo mobile o web

Flutter: Falling in Love Again with Mobile and Web Dev

Lorenzo Ermigiotti
December 9, 2020
Share on:facebooktwitterlinkedinreddit
Cate Lawrence
Of Unicorns in Tech and of the Value of LGBTIQ+
Previous Post
What Are the Main Areas of Development for a Data Analyst’s Career?
Next Post

Footer

Discover

  • Events
  • Community
  • Partners
  • Become a partner
  • Hackathons

Magazine

  • Tech articles

Talent

  • Discover talent
  • Jobs

Companies

  • Discover companies

For Business

  • Codemotion for companies

About

  • About us
  • Become a contributor
  • Work with us
  • Contact us

Follow Us

© Copyright Codemotion srl Via Marsala, 29/H, 00185 Roma P.IVA 12392791005 | Privacy policy | Terms and conditions