使用自定义分配策略重新配置时更新设备孪生

发布于 2025-01-09 09:45:47 字数 463 浏览 1 评论 0原文

在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

秋意浓 2025-01-16 09:45:47

我已经确认,当“重新配置和迁移数据”时,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".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文