I am trying to implement Local Fulfillment in my Google Smart Home Action.
some of my devices have 2 channels (dual relay switch).
Dual channel device is shown in Google Home app as two separate devices(light-test123123_0
and light-test123123_1
) and it works just fine.
I have added customData
and otherDevicesIds
to my SYNC response to enable local fultilment and built an local app using @google/local-home-sdk
. Google Home identifies Single channel devices and sends commands locally.
example of SYNC response body:
{
"response": {
"payload": {
"devices": [
{
"traits": [
"action.devices.traits.OnOff",
"action.devices.traits.Brightness"
],
"customData": {
"path": "/local-fulfil/0/",
"port": 3000
},
"name": {
"name": "light",
"nicknames": [
"light"
],
"defaultNames": [
"light"
]
},
"id": "light-test123123_0",
"type": "action.devices.types.LIGHT",
"deviceInfo": {
"hwVersion": "LIGHT",
"model": "LIGHT",
"swVersion": "1.0",
"manufacturer": "MANUFATURER"
},
"attributes": {},
"willReportState": false,
"otherDeviceIds": [
{
"deviceId": "light-test123123_0"
},
{
"deviceId": "light-test123123"
}
]
},
{
"name": {
"nicknames": [
"light"
],
"defaultNames": [
"light"
],
"name": "light"
},
"deviceInfo": {
"swVersion": "1.0",
"hwVersion": "LIGHT",
"manufacturer": "MANUFATURER",
"model": "LIGHT"
},
"attributes": {},
"otherDeviceIds": [
{
"deviceId": "light-test123123_1"
},
{
"deviceId": "light-test123123"
}
],
"willReportState": false,
"traits": [
"action.devices.traits.OnOff",
"action.devices.traits.Brightness"
],
"id": "light-test123123_1",
"customData": {
"port": 3000,
"path": "/local-fulfil/1/"
},
"type": "action.devices.types.LIGHT"
}
],
"agentUserId": "RuRHIPWpD5W23iGiU81A5PoTKqB2"
},
"requestId": "16772679358918515269"
}
}
The problems appeared when I have started the local SDK implementation because even if my dual channel device sends 2 separate UDP packets with different IDs mentioned above. Google ignores one of them. Looks like it is not possible to have 2 devices with same IP address.
Here is the IDENTIFY request body:
{
"requestId": "88DB84992F074FF0B408D8383CF198C4",
"inputs": [
{
"intent": "action.devices.IDENTIFY",
"payload": {
"device": {
"udpScanData": {
"data": "6C696768742D6475616C2D3132335F30"
}
},
"structureData": {}
}
}
],
"devices": [
{
"id": "light-dual-123_0",
"customData": {
"path": "/local-fulfil/0/",
"port": 3000
}
},
{
"id": "light-dual-123_1",
"customData": {
"path": "/local-fulfil/1/",
"port": 3000
}
}
]
}
and response:
{
"intent": "action.devices.IDENTIFY",
"requestId": "88DB84992F074FF0B408D8383CF198C4",
"payload": {
"device": {
"id": "",
"verificationId": "light-test123123_0"
}
}
}
I have written a basic app that sends UDP broadcast and it outputs the next data:
sent broadcast packet
192.168.1.235:8888 sent this: light-test123123_0
192.168.1.235:8888 sent this: light-test123123_1
That shows how my device acts when it receives a broadcast packet.
Is there a way to fix this?
The Local Fulfillment platform currently (as of Local Home SDK 1.4) uniquely identify the device by their network address, so it won't be able to handle multiple broadcast response coming from the same physical connected device.
You can however have one device acting as a proxy for multiple end-devices, this is done by:
isProxy
flag to true in the IDENTIFY
response:
https://developers.google.com/assistant/smarthome/develop/local#hub-identifyREACHABLE_DEVICES
intent to return all the end-device verificationId
:
https://developers.google.com/assistant/smarthome/develop/local#hub-identifyThe Local Home SDK sample includes a virtual device that can be run in this configuration: https://github.com/actions-on-google/smart-home-local#set-up-the-virtual-device