My weather-station is publishing its status via MQTT to AWS IoT.
The message is published to topic
$aws/things/my-weather-station-001/shadow/update and looks like this:
{
"state": {
"reported": {
"temperature" : 22,
"humidity" : 70,
....
"wind" : 234,
"air" : 345
}
}
After message is received I have create a rule to store it in AWS DynamoDB the rules select statement is:
SELECT state.reported.* FROM $aws/things/+/shadow/update/accepted
And when this works well, whilst I am sending messages containing state.reported field.
However sometimes to the topic $aws/things/weather-station-0001/shadow/update are sent "control" messages telling device to switch on an LED or some other part. These messages would be usually sent by an app or a controlling server and look like this notice that instead of reported field it hasdesired
{
"state": {
"desired": {
"led1" : "on",
"locked" : true
}
}
So when these messages are arriving, they ARE STILL processed by the rule and arrive to the DynamoDb table with {} empty payload.
Is there any way to force the Rule to ignore messages not containing state.reported element?
$aws/things/<thing_name>/shadow/update- cementblocks$aws/things/<thing_name>/shadow/update/acceptedor if you're interested in deltas to../shadow/update/delta. If you subscribe only to..shadow/updateyou are NOT really using shadows service, but simply getting back the update you sent (including when it is malformed). You can read more on that on docs.aws.amazon.com/iot/latest/developerguide/… - Dimitry KThe message is published to topic $aws/things/my-weather-station-001/update and looks like this:has the incorrect topic, you should publish to$aws/things/my-weather-station-001/shadow/update- cementblocks$aws/things/my-weather-station-001/shadow/update- Dimitry K