The Local Home SDK enhances your smart home integration with the Google Assistant by adding a local execution path to route smart home intents.
Integration of the SDK offers performance improvements to your smart home Action, including lower latency and higher reliability. Local execution is supported for all device types and device traits, except those that use two-factor authentication.
Understand how it works
After getting a
from your cloud fulfillment, the Local Home platform scans the user’s
local area network using mDNS, UDP broadcast, or UPnP to discover
smart devices connected to the Assistant.
The platform sends an
IDENTIFY intent to determine if the device is
locally controllable, by comparing the device ID in the
to those returned by the earlier
SYNC response. If the detected device is a
hub or bridge, the platform sends a
REACHABLE_DEVICES intent and treats the
hub as the proxy device for communicating locally.
When it receives a response confirming a local device, the platform establishes a local execution path to the user’s Google Home or Google Nest device, and subsequently routes user commands for local execution.
When a user triggers a smart home Action that has a local execution path,
the Assistant sends the
intent to the Google Home or Google Nest device rather than the cloud fulfillment. The device then
runs the local execution app to process the intent.
Local execution app
The local execution app contains the business logic to process the intents sent by the Local Home platform and access your smart device via the local area network. No modification of your hardware is expected to integrate local execution. The app fulfills smart home Action requests by sending control commands to the smart device through application-layer protocols, including HTTPS, TCP, or UDP. In the event that the local execution path fails, your cloud fulfilment is used as a fallback execution path.
To support building the app, the Local Home SDK provides these two main classes:
DeviceManager: Provides methods to communicate with smart devices using TCP, UDP sockets, or HTTP/HTTPS requests.
App: Provides methods to attach handlers for intents that Google sends after discovering locally-controllable devices (
REACHABLE_DEVICES) and to fulfill user commands (
To utilize the Local Home SDK for your smart home integration, you need to perform these tasks:
|1||Set up the scan config||Configure the Actions console with the necessary parameters for the Assistant to discover locally controllable devices.|
|2||Update the SYNC response in your cloud fulfillment||In your cloud fulfillment, modify the
|4||Test and debug your app||Test your integration (or self-certify) by using the test suite for smart home.|
To start using local execution, see Add local execution to your smart home Action.