Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    How to check whether a message has been published to AWS using MQTT on cellular network

    Scheduled Pinned Locked Moved Discussion
    aws mqttaws iotgpycellularconnection
    2 Posts 2 Posters 422 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      dexter12
      last edited by

      Hi !

      Objective:
      I'm trying to build a hardware module that will periodically push out data to AWS IoT via MQTT( like a heartbeat). I'd like to conserve power by detaching from the network after sending an MQTT message and reconnect prior to sending a new one.

      Problem:
      Seems like AWSMQTT library uses sockets that spawn a new thread for publishing messages. However, there isn't a way to know the status of the thread.
      1 - Is there a way to know once the thread successfully sent a message? That could help me as an indicator if the device can be smoothly detached from the network.
      2 - Is there a better way to do this then what I've proposed.

      Thanks in advance!

      1 Reply Last reply Reply Quote 0
      • M Offline
        Martinnn
        last edited by

        I would try to monitor the length of the output queue. See _io_thread_func in MQTTMsgHandler.py - in there there's the transmit loop and you could add some signaling there to indicate the TX queue is empty.

        You'll probably need to modify the code and rename the function so you are not using the builtin frozen ones.

        1 Reply Last reply Reply Quote 1

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • 1 / 1
        • First post
          Last post

        Pycom on Twitter

        Pycom