Device MetaData in AWS IOT core

0

Can we store Device/Thing MetaData in AWS IOT core ? We have iot things that we provision using fleet provisioning. These devices have metadata associated with it and other characteristics example battery health data which can change. What is a good practice to maintain this data ? Should we use device shadows to maintain the battery health etc ? This data only flows from the device to aws and not vice versa , is the device shadow still a good place to hold the information ? How do we store the metadata associated with a thing ? We will need to retrieve this data using api's when needed.

Smr
已提問 2 年前檢視次數 542 次
1 個回答
1

Hi, to store data related to the device that changes over time you can use Thing Shadows. To report state you will publish your data on $aws/thing/<thing_name>/shadow/update in the following format

{
  "state": {
      "reported": {
           "battery": 0.40
      }
   }
}

To read the data you can either use the Thing Shadow REST API GetThingShadow [1] or subscribe to $aws/thing/<thing_name>/shadow/get/+ and publish a message on $aws/thing/<thing_name>/shadow/get. [2]

[1] https://docs.aws.amazon.com/iot/latest/apireference/API_iotdata_GetThingShadow.html [2] https://docs.aws.amazon.com/iot/latest/developerguide/device-shadow-mqtt.html

AWS
專家
已回答 2 年前
  • Thank you . And can you help me with what is a good practice to store the metadata ?

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南