Azure IoT设备正在接收孪生更新通知

问题描述 投票:0回答:1

我尝试通过订阅主题“ $ iothub / twin / PATCH / properties /#”(reference)和sdk(refernece)来接收所需的属性更新通知。两者都没问题,当我通过后端服务更改了所需的属性时,确实收到了通知,但所有所需的属性都作为响应。 sdk中是否有一个主题或函数只是获取更改之处的属性?还是想知道巫婆的属性是在没有查看所有所需属性的情况下更改的?

感谢您的帮助!

azure azure-iot-hub azure-iot-sdk
1个回答
0
投票

您应该使用PATCH请求来更新后端服务中的所需属性。以下屏幕片段显示了仅更新一个所需属性(例如color)的示例。为了快速演示,使用the Azure IoT Hub Tester

  1. 创建两个所需的属性(颜色abc):enter image description here

  2. device8收到了更改通知(版本= 2):enter image description here

  3. 在此步骤中,我们只需要更新一个所需的属性(color):enter image description here

  4. device8收到了更改通知(版本= 3),例如属性colorenter image description here

如上图所示,device8订阅了您提到的主题。您没有描述后端服务如何更新所需的属性。

注意,以上示例使用REST PATCH调用来更新所需的属性。

© www.soinside.com 2019 - 2024. All rights reserved.