Reputation: 3
I have an Azure IoT edge device. This edge device has one module that simulates a real machine. I would like to configure this edge module (e.g. the simulation time interval, number of items to simulate). I could use either desired properties or environment variables for that. Which makes more sense? What are the intentions and the main differences between desired properties and environment variables?
I don't see much differences as:
The only difference I see so far is that I can subscribe to changes to desired properties. This doesn't seem to be possible for changes to environment variables (however, then the module would restart and read the new environment variables).
Upvotes: 0
Views: 272
Reputation: 11
As explained above, the desire properties are part of your device or module Digital Twin. The Digital Twin is stored in the IoT Hub (in the device registry) and is used to keep the state of your devices in sync with the [cloud] backend services.
The advantage of using the device twin to store your device state is that it can be changed from the backend side, by modifying the device desired properties
, and your device will receive the desired property change
and then, your device can use the device reported properties
to inform that the request change has been accepted (and executed whatever the action it should run in the device). This allows to maintain the device and backend in sync.
For detailed information on device twin and desired and reported properties, check: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-device-twins
Upvotes: 0
Reputation: 347
Desired properties represent the state of your module and is better suited than environment variables for few reasons.
Upvotes: 1