0

我正在尝试通知我的设备以了解其设备孪生的更改。在阅读了几乎所有 Azure 的文档后,我找不到任何解决方案来直接通知设备应用程序进行设备孪生更新,而不是通过运行订阅事件中心的服务,并将接收到的消息发送到设备。此外,Azure 提供的用于发送云到设备消息的 python 代码崩溃。有没有人有这种沟通的成功经验?

4

1 回答 1

1

给你,来自官方的 github repo。

async def twin_patch_listener(device_client):
        while True:
            patch = await device_client.receive_twin_desired_properties_patch()  # blocking call
            print("the data in the desired properties patch was: {}".format(patch))

# Schedule task for twin patch
asyncio.create_task(twin_patch_listener(device_client))
于 2019-10-30T07:58:07.007 回答