This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3220SF-LAUNCHXL: TIDM-1020: Subscribe to topic at AWS Console?

Part Number: CC3220SF-LAUNCHXL

Hi,

From this json struct at wifi_thermostat example, is the "temperature" a topic, in which at AWS IOT Console ->Test I can view the temperature data?

temperatureHandler.cb = NULL;
temperatureHandler.pKey = "temperature";
temperatureHandler.pData = &temperature;
temperatureHandler.type = SHADOW_JSON_UINT32;
temperatureHandler.dataLength = sizeof(int);

Should I use this below instead to publish to a topic?

aws_iot_mqtt_publish()

-kel

  • Hi kel,

    No, the temperature shadow JSON variable is not a topic by itself. However, the shadow JSON document as a whole is published to a dedicated set of shadow topics that you could monitor. See the AWS documentation here for what shadow topics are available: https://docs.aws.amazon.com/iot/latest/developerguide/device-shadow-mqtt.html. Keep in mind that there is also the option to view and edit the shadow directly in a thing's settings page.

    That being said, you should probably use the AWS SDK's shadow manipulation APIs rather than publish directly to the shadow topics for ease of use reasons. The SDK functions you should use are the aws_iot_shadow_*() functions, and you can find an example of their use in the PUB_DEVICE_UPDATE case handled by the MqttClient() in mqtt_client_task.c. 

    Let me know if you need more clarification, or have further questions on shadow manipulation with AWS IoT.

    Regards,

    Michael

  • So, I need to subscribe /things/thermo_thing/shadow/get to get the data.

    Actually, I am trying to save the temperature data to DynamoDB using this guide. But, seems the subscribe publish is a much simpler example program to try and do this.

    -kel

  • Hi Kel,

    If you just want to follow that dynamoDB guide, then I agree that simply using the subscribe publish example will be simpler.

    The main issue with relying on subscribe publish is that you will need to figure out how to identify each device that publishes to topic you choose. With device shadows, that is taken care of for you. However, once you have a method to identify those devices then you should have no issues with just subscribing and publishing to general topics.

    Regards,

    Michael