Jon Th
Jon Th

Reputation: 377

Azure IoT device needs to get desired properties from while it was offline

I'm developing an Azure IoT application. All my devices are connected to an Azure IoT Hub and use device twins. My problem is this:

If a device goes offline and then my backend web application causes changes to the device's desired twin properties, the device doesn't seem to get that info later when it reboots.

How can the device get this when rebooting? When the device reboots, I want it to retrieve all the desired property notifications that came while it was offline. Is this possible and if so, what are the ways to do it?

Upvotes: 1

Views: 725

Answers (1)

asergaz
asergaz

Reputation: 1051

Agregating the comments an convert them to an answer:

@Roman Kiss

"In the case of restarting (rebooting), the device should read all device desired properties and walked through them for their synchronizing in the manner of the transition state... after the device is connected to the Azure IoT Hub, the device can get the desired properties from the IoT Hub. Each desired property should be represented some state object with details about the transitions. This details will actually described the status of the state transition. Every change made on the ends such as at the device and back-end must go through transitions, that why we have the reported and desired properties... my sequence diagram described this distributed dis-connectabled state machine where each transition must be well described in the reported and desired properties. If the process of the transition is broken (disconnected, etc.), based on the last transition state in the reported and desired properties can be synchronized and continue to the finally state such as the reported and desired properties are the same."

Related thread: Azure IoT - What if both server and client are changing device twin properties?

@iAviator

"It's up to the backend service to take action on desired property based on reported property. Either you delete the desired property as the device has attained it's state or keep it."

====

Please mark it as answer so others can benefit from your discussion. Thanks!

Upvotes: 1

Related Questions