[MUSIC PLAYING]
NICK FELKER: Hey, I'm Nick Felker, and today--
hold on, give me a second.
OK Google, turn on the studio lights.
GOOGLE ASSISTANT: OK, turning the studio lights on.
NICK FELKER: Hey, I'm Nick Felker,
and today I'm going to talk to you about how
to make your Smart Home devices work with the Google Assistant
without building a conversational interface.
Right now that Google Assistant works
with more than 1,500 smart devices
from over 200 popular brands.
I'll show you just how easy it is for your devices
to be part of this ecosystem.
Hey Google, what's the weather going to be like today?
GOOGLE ASSISTANT: Today in Mountain View it
will be a high of 101 degrees.
NICK FELKER: Wow, that's really hot.
I should find a way to cool off.
So imagine you have a company selling
internet-connected fans, and you want your users to control them
from the Google Assistant, whether using
a voice-activated speaker like Google
Home, their phone, an Android TV, or any other
supported surface.
With the Actions on Google Smart Home API,
you can integrate your existing cloud-connected Smart Home
devices with the Google Assistant.
In this example, our smart fan has plastic fan blades
and a motor connected to a developer board.
This device listens to messages from our server
to turn on and off.
You can use any cloud service and device operating system
that you want.
The choice is yours.
So let's get started with making our fan work with the Google
Assistant.
You will need to connect your web server to the Google
Assistant.
Your web hook will be called when the user gives a command,
and your server will have to process the request
and complete the user's query.
You can link this web hook to a project in the Actions
on Google console.
Just select the option to build for a Smart Home
and provide the URL for your web hook.
In order to make sure that each user is only controlling
their own fan, you will need to set up OAuth credentials
so the Google Assistant can communicate securely
to your server.
Smart home devices connect to the HomeGraph, a database which
stores and provides contextual information about the user's
home and the devices inside.
For example, HomeGraph can store the concept
of a living room which contains multiple types of devices
from different manufacturers.
Without having to deal with parsing sentences yourself,
you can handle complex queries like cool down living room
or make my living room light brighter.
The Google Assistant uses information
in order to execute user requests based
on the appropriate context.
Your web hook communicates with the Assistant servers,
receiving intents and responding by taking action on devices,
or responding with information about a user's devices.
For example, your web hook will be
asked to provide a list of user's connected devices
via a sync intent.
It can also be asked to turn the fan on or off
with an execute intent.
Your client will have to handle the actual management
of the state and execution.
If asked whether the fan is on, a query intent
will ask your web hook to provide
the current state of the fan.
When using Smart Home API, you provide a list of traits
that your device can support.
For example, my fan can turn on and off.
The Google Assistant handles all the possible ways
you can say that.
You don't write your own grammars
nor build a conversational app.
When you just say, "turn my workshop fan on, please,"
the Google Assistant processes your command.
The home graph understands that you have a fan in your workshop
and that it can turn on and off.
Then the Google Assistant will turn that
into a structured JSON payload that it sends to your web
hook for processing.
After creating your Smart Home integration,
you can use the Actions on Google console
to view the usage and health of your integration
from your users.
Now that web hook is done, we can
open the Home Control Settings in the Google Assistant.
I can link to the NIC app and get back all of my devices.
Once the devices are synced, I can control them.
OK Google, turn on the workshop fan.
GOOGLE ASSISTANT: OK, turning the workshop fan on.
NICK FELKER: Ah, this is much better.
I hope this video helped explain how
to get started with integrated your Smart Home devices
with the Google Assistant.
I think I'm forgetting something.
OK Google, is my smart fan still on?
GOOGLE ASSISTANT: Yes, the workshop fan is on.
NICK FELKER: Visit the documentation
to learn more about Smart Home, and join our community
to discuss this with other developers.
[MUSIC PLAYING]