简体   繁体   English

如何在 Google Smart Home Local Fulfillment 中处理多通道设备的 IDENTIFY 请求?

[英]How to handle IDENTIFY request in Google Smart Home Local Fulfilment for multi channel device?

I am trying to implement Local Fulfillment in my Google Smart Home Action.我正在尝试在我的 Google 智能家居操作中实施本地履行。 some of my devices have 2 channels (dual relay switch).我的一些设备有 2 个通道(双继电器开关)。
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.双通道设备在 Google Home 应用程序中显示为两个独立的设备( light-test123123_0light-test123123_1 ),它工作得很好。

I have added customData and otherDevicesIds to my SYNC response to enable local fultilment and built an local app using @google/local-home-sdk .我已将customDataotherDevicesIds添加到我的 SYNC 响应中以启用本地实现并使用@google/local-home-sdk构建本地应用程序。 Google Home identifies Single channel devices and sends commands locally. Google Home 识别单通道设备并在本地发送命令。

example of SYNC response body: SYNC 响应正文示例:

{
    "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.当我启动本地 SDK 实现时出现问题,因为即使我的双通道设备发送 2 个单独的 UDP 数据包,具有上述不同的 ID。 Google ignores one of them.谷歌忽略了其中之一。 Looks like it is not possible to have 2 devices with same IP address.看起来不可能有 2 个具有相同 IP 地址的设备。

Here is the IDENTIFY request body:这是 IDENTIFY 请求正文:

{
    "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:我编写了一个发送 UDP 广播的基本应用程序,它输出下一个数据:

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.当前的本地履行平台(从本地主页 SDK 1.4 开始)通过设备的网络地址唯一地识别设备,因此它无法处理来自同一物理连接设备的多个广播响应。

You can however have one device acting as a proxy for multiple end-devices, this is done by:但是,您可以让一个设备充当多个终端设备的代理,这是通过以下方式完成的:

The 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 Local Home SDK 示例包括一个可以在此配置中运行的虚拟设备: https://github.com/actions-on-google/smart-home-local#set-up-the-virtual-device

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google Home 不向我的智能家居设备发送 UDP 广播 - Google Home doesn't send UDP broadcast to my smart home device 如何在我的智能灯泡上添加对Google Home应用的支持? - How to add support for google home app to my smart bulb? Alexa(智能家居技能),以确定设备是否离线。 - Alexa (Smart Home Skill) to determine if device is offline. 智能家居环境中的本地区块链与集中式数据库 - Local blockchain vs. centralized database in a smart home environment 创建由Google Home控制的IoT设备 - create IoT device controlled by google home 区块链在智能家居中的使用 - Blockchain usage in smart home Google IOT:在 sendCommandtoDevice 失败后识别设备重新联机 - Google IOT: Identify the device is back online after sendCommandtoDevice failure “智能家居”物联网WebSocket --> 服务器WebSocket --> 客户端 - “smart home” IOT WebSocket --> Server WebSocket --> Client 具有自定义消息的Alexa智能家居响应 - Alexa Smart Home Response with Custom Message 是否可以以编程方式调用和识别来自 Google Home 回声设备的任何操作? - Is possible to programmatically get invocation and recognition of any action from Google Home echo device?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM