Update module twin property for multiple devices

Viewed 233

When having iot edge with multiple modules running. How to update a desired property of a module twin for multiple devices (100+)?

Using jobs seems the way to go for device twins. But I can't get this to work for module twins. Is this not supported (yet)?

1 Answers

You could create a Configuration for a module twin with a given condition.

Automatic device management works by updating a set of device twins or module twins with desired properties and reporting a summary that's based on twin reported properties. It introduces a new class and JSON document called a Configuration that has three parts:

  • The target condition defines the scope of device twins or module twins to be updated. The target condition is specified as a query on twin tags and/or reported properties.

  • The target content defines the desired properties to be added or
    updated in the targeted device twins or module twins. The content
    includes a path to the section of desired properties to be changed.

  • The metrics define the summary counts of various configuration states such as Success, In Progress, and Error. Custom metrics are specified as queries on twin reported properties. System metrics are the
    default metrics that measure twin update status, such as the number
    of twins that are targeted and the number of twins that have been
    successfully updated.

Before you create a configuration, you must specify which devices or modules you want to affect. Azure IoT Hub identifies devices and using tags in the device twin, and identifies modules using tags in the module twin. Each device or modules can have multiple tags, and you can define them any way that makes sense for your solution.

Please follow this documentation: IoT device and module management for more details.

Related