0
votes

AWS IoT documentation says.

When a device goes offline, an app can still communicate with AWS IoT and the device's shadows. When the device reconnects, it receives the current state of its shadows so that it can update its state to match that of its shadows, and then publish a message with its updated state.

How not to retrieve data from the shadow if the device of offline?

or how to ignore outdated data from AWS IoT shadow?

1
Can't you ignore outdated data by tracking a version or timestamp field in the shadow in your app?Ben T
@BenT We are thinking of using timestamps to ignore outdated data. I needed to check if there is a better way to do that.Harsha Jayamanna

1 Answers

0
votes

Why would you not want the shadow data to reflect on device since it represents the device's latest state?

Anyways if you dont want the shadow data for offline devices there are two options apart from the timestamp logic : When a device gets offline you can be notified in LWT message and on recieving that event :

There are two ways to delete shadow data: you can delete specific properties in the shadow document and you can delete the shadow completely.

To delete specific properties from a shadow, update the shadow; however set the value of the properties that you want to delete to null. Fields with a value of null are removed from the shadow document.

To delete the entire shadow, use the DeleteThingShadow API or publish to the /delete topic. Reference: https://docs.aws.amazon.com/iot/latest/developerguide/device-shadow-data-flow.html