You can build smart home Actions that let users control Internet of Things (IoT) devices through the Google Assistant. Building smart home Actions lets you connect, query, and control devices through your existing cloud infrastructure.
Smart home Actions rely on Home Graph, a database that stores and provides contextual data about the home and its devices. For example, Home Graph can store the concept of a living room that contains multiple types of devices (a light, television, and speaker) from different manufacturers. This information is passed to the Google Assistant in order to execute user requests based on the appropriate context.
Get the end-to-end sample for smart home Actions by downloading or cloning from GitHub.
User set up their devices with the Google Assistant app to authenticate to your cloud services and the Assistant receives an OAuth token. At this point, the Assistant sends an
action.devices.SYNC intent to your fulfillment to retrieve the initial list of user devices and capabilities from your cloud infrastructure.
You can send a request to the Google Assistant with the
intent, which sends the
action.devices.SYNC intent to your
fulfillment to sync the list of devices and capabilities again.
When users ask the Assistant to send commands to devices, your fulfillment receives a
action.devices.EXECUTE intent with a payload that describes the action and the devices to act upon.
Querying device status
Querying of device status, either to answer a user question like "What
lights are on in the kitchen?" or to handle relative brightness commands
like "Turn up my lights" happens with the Assistant sending an
action.devices.QUERY intent to your fulfillment.
Third parties can report the current state of their devices directly to Home Graph.