🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Publish mqtt to AWS Iot from UiFlow

    Scheduled Pinned Locked Moved UIFlow
    3 Posts 3 Posters 4.9k Views
    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.
    • I Offline
      isengard-nd
      last edited by

      Hi,
      I'm wondering if it's possible to publish messages to an MQTT topic on AWS IOT.
      Here's how I'm initializing my MQTT session

      m5mqtt = M5mqtt('MY_DEVICE_NAME', 'IOT_CORE_ENDPOINT', 8883, '', '', 4000, ssl = True, ssl_params = {'key': "PATH_TO_MY_PRIVATE_KEY", 'cert': "PATH_TO_MY_CERTIFICATE"})

      But it doesn't work. Any suggestions ?
      Thanks for your help

      Thanks,

      1 Reply Last reply Reply Quote 0
      • ZontexZ Offline
        Zontex
        last edited by

        Hello,
        Could you try with the ssl settings disabled to see if it works? I'm wondering if it's SSL certificate path issues or your AWS server, have you copied the ssl key and certificate to the M5Stack device? make sure you import it in the right directory.

        1 Reply Last reply Reply Quote 0
        • greenleafG Offline
          greenleaf
          last edited by greenleaf

          I am also stuck trying to get this to work. Some research reveals that there may be a ca_certs parameter required to include Amazon's root CA. I've tried it like this but no luck:

          while True:
            output.setText('Setting up mqtt')
            m5mqtt = M5mqtt('m5stick', 'a2zey9c7ts6fdf-ats.iot.us-west-2.amazonaws.com', 1883, '', '', 300, ssl = True, ssl_params = {'key': "/flash/res/priv.key", 'cert': "/flash/res/cert.pem", 'ca_certs': "/flash/res/ca.pem"})
            m5mqtt.subscribe(str(''), fun__)
            output.setText('starting mqtt')
            m5mqtt.start()
            output.setText('publishing hello world')
            m5mqtt.publish(str('test'),str('hello world'))
            output.setText('sent hello world')
            wait(1)
            wait_ms(2)
          

          Can anyone from m5stack confirm whether ca_certs is a supported ssl parameter?

          1 Reply Last reply Reply Quote 0

          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
          • First post
            Last post