使用自定义分配策略重新配置时更新设备孪生
在 Azure 设备配置服务中
- ,当使用自定义分配策略时,
- 通过“--reprovision-policy reprovisionandmigratedata”,
是否可以在更改集线器时迁移设备孪生数据并更改孪生中的某些值?
从实验来看,在集线器之间移动时(而不是第一次注册),initialTwin
会被忽略,这并不意外。
示例
假设设备 d1 已配置到 hub1,其所需的时间是
"desired" : {
"a": 1
}
一段时间后 d1 重新配置并执行分配函数,并且它将移动将设备连接到hub2。我需要新的期望是:
"desired" : {
"a": 2
}
In Azure Device Provisioning Service
- when using a custom allocation policy,
- with '--reprovision-policy reprovisionandmigratedata'
is it possible to migrate the device twin data when the changing hubs and change some of the values in the twin?
From experiments initialTwin
is ignored when moving between hubs (as opposed to registered for the first time) which is not that unexpected.
Example
Let's say that device d1 is provisioned to hub1 and its desired is
"desired" : {
"a": 1
}
Some time later d1 reprovisions and the allocation function is executed and it will move the device to hub2. I need the new desired to be:
"desired" : {
"a": 2
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经确认,当“重新配置和迁移数据”时,
initialTwin
将被忽略,这是设计使然。另一种方法是作为自定义分配的一部分从设备查询最新的孪生,添加新属性并将其发送到 DPS,同时选择“重新配置并重置为初始配置”。
I have confirmed that when "re-provision and migrate data" the
initialTwin
will be ignored and that is by design.An alternative is to query the latest twin from the device as part of custom allocation, add the new property and send it to DPS while choosing "re-provision and reset to initial config".