A local fulfillment path is established when Google matches a locally-controllable device
to a device returned in the SYNC
response from your cloud fulfillment.
To enable Google to discover your device on the local network and establish the
local fulfillment path, you need to add discovery information in the Actions console.
You also need to update the SYNC
response from your cloud fulfillment to let
Google know about the locally-controllable device.
Set up the scan config information
To specify the discovery information, follow these steps:
Go to your Cloud-to-cloud integration in the Google Home Developer Console:
Go to Project > Cloud-to-cloud on the left side of the screen, then select Edit for the integration. In the Setup and configuration page, scroll to Local fulfillment and toggle the setting on. Enter the following URL into each test URL field, insert your project ID, and click Save:
https://<project-id>.web.app/local-home/index.html
Click + Add scan configuration under Device discovery to add a new scan configuration.
Select a scan matching protocol type from the drop-down and enter values for Google to scan.
The following tables show the attributes you can add, based on the protocols you want Google to use to scan for your device:
Attribute | Description | Example Value |
---|---|---|
Service Name |
Required. Service name published by the device in the format
service.domain .
|
_http._tcp.local |
Name |
Required. Filter for a unique service instance in the
format |
my-device-[0-9]{4}\._http\._tcp\.local |
Attribute | Description | Example Value |
---|---|---|
Service Type |
Required. Fully qualified identifier of the UPnP service in the format
domain:service:type:version .
|
schemas-upnp-org:service:SwitchPower:1 |
OUI |
Optional. Organizationally Unique Identifier. 24-bit value identifying the device manufacturer. Typically, the first three octets of the device MAC address. |
1A:2B:3C |
Attribute | Description | Example Value |
---|---|---|
Discovery Address | Required. Destination IP address for the UDP broadcast. | 255.255.255.255 |
Broadcasting Port | Required. Destination port for the UDP broadcast. | 5555 |
Listening Port | Required. Listen port for the UDP discovery response. | 5556 |
Discovery Packet | Required. Payload to send in the UDP broadcast. Formatted as a hexadecimal encoded string of bytes. |
48454C4C4F |
Update SYNC response in the cloud fulfillment
The SYNC
intent reports to
Assistant what devices the user controls and their capabilities.
To support local fulfillment, the Local Home platform checks the SYNC
response
from your smart home Action's cloud fulfillment and tries to match the device
IDs in the otherDeviceIds
field to the verification ID returned by the
IDENTIFY
handler. Device entries without an otherDeviceIds
field are
excluded from local fulfillment.
In the
otherDeviceIds
field of the SYNC
response, you need to set the device IDs of smart home
devices that can be locally controlled. The field appears at the device
level
in the response. Google can establish a local fulfillment path on any device with
the given ID.
Use the customData
field to specify any additional data Google needs to
connect to a standalone device, or to target end devices using a hub
(for example, the port number and other protocol-specific information).
Example
The following snippet shows how you might create your SYNC
handler.
{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "payload": { "agentUserId": "1836.15267389", "devices": [{ "id": "123", "type": "action.devices.types.OUTLET", "traits": [ "action.devices.traits.OnOff" ], "name": { "name": "Night light" }, "willReportState": false, "otherDeviceIds": [{ "deviceId": "local-device-id" }], "customData": { "port": 5555, "authToken": "..." } }] } }