Some time ago we spoke about an ‘all in one’ temperature and humidity sensor for AWS IoT integration. You recommended a MQTT sensor and wrote me this guide:
I’ve only just now got around to doing this and have 2x issues…
My “topic format” is “CTS_MAN/::Sensor_ID::”, however, in AWS when I try and subscribe to “CTS_MAN/#” I get a message saying “You cannot publish messages to a wildcard topic”.
In AWS under devices I can see my device, however, when I setup a device shadow (classic with no name) I am NOT getting any update shadows from the device
When I first open MQTT test client for the device I can see data when I subscribe to “CTS_MAN/#”. However, the “$aws/things/CTS_MAN/shadow/update/documents” subscription shows no data at all. I can see this subscription working for my AWS gateway (previously integrated) however not for this new MQTT device.
Updating the device shadow requires publishing to a different topic. The device is currently publishing to the topic CTS_MAN/::Sensor_ID:: rather than the Shadow Document topic.
Sorry @scott.wells not sure why I’m not getting notifications about this thread. Please tag me in future replies.
AWS IoT Core Doc here outlines everything about interacting with the Shadow Document through MQTT:
Keep in mind the policy attached to the AWS IoT Thing you created needs to specify the device is allowed to update the shadow document. If you’re not sure please provide the device policy document here so I can take a look. It needs to specify allow:publish for the Device Shadow Document resource like this:
I’ve updated the “topic” to “$aws/things/CTS_MAN_11/shadow/update”. CTS_MAN_11 is the thing name.
The security policy I used was the one created when adding a NCD AWS Gateway previously. To try and eliminate this issue I have created a new policy specifically for this new device. I followed your instructions here: Connecting MQTT WiFi Sensors to AWS IoT Core - NCD.io
I think I see the problem. It’s been a long time since I wrote the AWS Gateway firmware. It looks like updating the shadow document requires the payload JSON to be in a particular format including reported state like this: