This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Publish to custom topic in aws_iot

Hi,

I have built a project upon the aws_iot-example. There are three shadow-topics that the device may publish to (/update, /get and /delete). To me it seems there is no possibility to publish to any other topic in aws_iot. Or am i wrong?

How should i do if I would like to publish to a named shadow in aws? Or a custom made topic?

Is it a good idea to copy aws_iot.c/.h into my project so I get a local copy of them, adjust them to suit my purposes and skip using the version in the library? If so, how do I exclude the original files?

Best regards,
Lars

Parents
  • Hi Lars, 

    To me it seems there is no possibility to publish to any other topic in aws_iot. Or am i wrong?

     According to the AWS IoT Shadow documentation "The Device Shadow service uses reserved MQTT topics to enable devices and apps to get, update, or delete the state information for a device (shadow)." However, you can configure any topics you want according to AWS IoT MQTT Topics

    These custom MQTT topics can then be configured in add_topics_subscribe().

    Is it a good idea to copy aws_iot.c/.h into my project so I get a local copy of them

    I'm not sure what you want to achieve. Please keep library as is. 

    Kind regards,
    Øyvind

Reply
  • Hi Lars, 

    To me it seems there is no possibility to publish to any other topic in aws_iot. Or am i wrong?

     According to the AWS IoT Shadow documentation "The Device Shadow service uses reserved MQTT topics to enable devices and apps to get, update, or delete the state information for a device (shadow)." However, you can configure any topics you want according to AWS IoT MQTT Topics

    These custom MQTT topics can then be configured in add_topics_subscribe().

    Is it a good idea to copy aws_iot.c/.h into my project so I get a local copy of them

    I'm not sure what you want to achieve. Please keep library as is. 

    Kind regards,
    Øyvind

Children
  • Hi Øyvind,

    I subscribe to a lot of custom made topics the way that app_topics_subscribe() shows. But I want to be able to publish to custom made topics. There is an enum in aws_iot.h, aws_iot_topic_type, which lists the shadow topics that can be published to. This sends to the unnamed shadow. But this doesn't give the possibility to send to a shadow you have made yourself.

    https://docs.aws.amazon.com/iot/latest/developerguide/reserved-topics.html#reserved-topics-shadow

    I'd like to to be able to create a named shadow in AWS IoT, and then publish to it. I don't see how that can be acheived in the aws_iot-example.

    Yes, I'm fully aware that the library must be untouched. That's why I saw it might be a possibility to make an own version of it, update it to suit my purposes, and skip the version in the library. There are so many things in aws_iot that I want to keep, so it's not an option to skip it and write all the communication parts myself. Or to start over with another of your examples that allows the possibility to publish to custom topics. But I don't know if it's a good idea. And I don't know how to exclude the library-version of aws_iot.c/.h from my project.

    Kind regards,
    Lars

Related