1

Updating a module twin results in a new 'unknown' update with the old values.

Steps to reproduce:

  1. create an automatic deployment based on a tag. deployment.template.json contains

    "mymodule": { "properties.desired": { "telemetryTakeCount": 100 } }

  2. update the module twin via the cli:

    az iot hub module-twin update -n myiothub -d mydevice -m mymodule--set properties.desired.telemetryTakeCount=126

  3. module twin update is received by the module

    [May 15 10:51:31]dbug: MyProject.AzureIotHubMethodHandlers[0] Desired property change: { "telemetryTakeCount": 126, "$version": 139 }

  4. Afer about 25 seconds a new module update is received, with the old values. [May 15 10:51:59]dbug: MyProject.AzureIotHubMethodHandlers[0] Desired property change: { "telemetryTakeCount": 100, "$version": 140 }

Why is this happing? As far is I know, I did not start a new update. This also happens when I update the module twin via the Azure Portal.

IotEdge version 1.0.9

The module twin retrieved after the last update, shows that $lastUpdatedBy is set to the last deployment. For all properties, not only the one I updated. Could this be related, that the deployment gets in the way?

William
  • 68
  • 5
  • You mentioned that the original value of `telemetryTakeCount` was `100`...how was that set? Was this device/module part of an [automatic](https://learn.microsoft.com/en-us/azure/iot-edge/module-deployment-monitoring) deployment? – Damon Barry May 20 '20 at 19:30
  • yes, the original value comes from a deployment based on a tag. Created in a devops release pipeline. – William May 22 '20 at 06:38
  • Yeah, I don’t think you can manually override an automatic deployment like that. There’s an agent in IoT Hub that is regularly looking for devices with the tag and updating their twins to match what’s in the deployment. You could use a layered deployment though, I believe. – Damon Barry May 23 '20 at 01:18
  • Layered deployments seem to be the solution. Thanks! – William May 25 '20 at 13:13

1 Answers1

0

Mixing an automatic deployment with a manual deployment does not work. We solved this by applying a layered deployment

William
  • 68
  • 5
  • so I added a layered deployment with an empty layeredProperties property. When I update the layeredProperties by adding a customer property it simply gets reverted back. I feel like Im missing something obvious here. I wish to be able to update the desiredProperties or layeredProperties from Azure UI and for them not to change back. – nlv Jan 17 '23 at 22:58