If you’re looking for a specific device type or trait that is not yet listed, email home-control-action-tses@google.
Device traitsDevice traits define the actual capabilities of your device, and these traits are what users can actually control.
A light can turn on and off (action.
OnOff) and a fan can change speed (action.
You can implement some or all suggested traits for your device type.
Traits are used in both QUERY and EXECUTE requests.
The QUERY call retrieves the state of the fan speed, while EXECUTE changes the state of the fan speed.
In Part 2 of this series, I’ll delve into how the JSON payload is defined for both QUERY and EXECUTE requests.
Again, if you are looking for a specific device type or trait that is not yet listed, email home-control-action-tses@google.
Home GraphThe Home Graph is Google’s database that houses all the smart home device contextual information.
Google stores the entire set of devices that the user controls, along with what room they are in, the name of the device, the device type and traits, and the pushed state of each device.
This is how Google knows which device to control when a user says things like:“Turn off the lights in the kitchen”The user has a collection of lights that are associated with the kitchen.
“Turn off the fan.
”The user may have multiple fans but only one is currently on, so it turns that particular fan off.
“Turn off the vacuum.
”The user did not specify a name or give a clue as to what room, but there is only one vacuum which can be controlled.
Google knows to turn off that particular vacuum.
The Home Graph is used in some way with every call.
For example, Google uses it when querying device information (for example, when associating an icon to use for a particular device) or for NLU when executing a command (for example, mapping what the user said to a device trait).
Your cloud service, in turn, uses the Home Graph API when pushing device state with the Report State API and SYNC calls.
Wrap-up & TL;DRThe critical takeaways here can be summarized in two main points:1.
Google handles all NLU for you and your IoT device.
Google communicates with your cloud service via a single webhook through JSON payloads.
Google does not communicate directly with your IoT device; your cloud service is responsible for communicating and maintaining state of the actual device as well as pushing this state to Google.
In order to implement an IoT service for the Assistant, you need to use Google’s device types, device traits, and the Home Graph.
In part 2 of this series, I’ll cover specific API calls, review the JSON structure of each call, and look at some of our sample code from GitHub.
To learn more about the topics covered in this blog post, check out these links:Device typesDevice traitsHome graphAction on Google codelabRequest new trait or device type: home-control-action-tses@google.
comAccount Linking with OAuth documentationBe sure to follow @ActionsOnGoogle on Twitter and follow me on LinkedIn for the latest news.
Head on over to the Action on Google codelab to get started!.