Dimitry K
Dimitry K

Reputation: 2356

Should device working with AWS IoT be publishing to its shadow only?

Let's say we have a device with sensors (eg. bunch of weather sensors like wind/air/hum/temp) and this device needs to report it's state to AWS IoT.

Let's say that every minute device would be publishing a bunch of readings as one big json:

{
   "temp" : 10,
   "wind:  100,
   "humidity" : 98.3,
   .... 
   ....
   "metric98": 23456,
   "metric99": 56789
}

I can see two ways to send these updates to AWS IoT:

In both cases I will have to create a rule on AWS IoT which will later throw these metrics into DynamoDb or process them in any other ways.

Which topic ($aws/... or mine) is it better to use to publish the metrics?

ps. I am aware that AWoT Shadows service is very convenient to calculate deltas vs "desired" state. But the trick in my case, that for the regular "metrics" from the weather station (like temperature or humidity), I don't have a "desired" state. I am not going to be setting temperature on the device, only reading, thus no need in calculating deltas.

Upvotes: 4

Views: 2898

Answers (1)

sridhar_rajagopal
sridhar_rajagopal

Reputation: 180

There is a similar query on the AWS IOT forum - https://forums.aws.amazon.com/thread.jspa?messageID=703199&#703199

Bottom line, you could go either way. It is not exactly clear at this juncture if one has a decided advantage over the other. With a custom topic, there is no need for calculating deltas and other overheads of the shadow topic, as you mentioned, so this could reduce latency, but unless you have a ton of sensors and are constantly publishing values, this shouldn't be an issue, I think.

One could argue that the sensor values do still constitute the "state" of the device (which constantly keeps changing), and those values are "read-only", so a desired state doesn't have meaning, and so will not be used by the client.

It will be nice if some AWS architect can weigh in.

Upvotes: 2

Related Questions