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

    Issue with Publishing and Subscribing in MQTT

    Scheduled Pinned Locked Moved UiFlow 2.0
    3 Posts 2 Posters 2.1k 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.
    • R Offline
      Robertof
      last edited by Robertof

      [link text](link url)Hello everyone,

      I'm facing issues with both subscription and publishing in MQTT. When publishing, it does not allow me to send alphanumeric values. If I use a numeric string and then convert it to an integer, it works correctly, as shown in the following example:

      MQTT publish topic "coreS3/state", "5", Qos 1

      However, when I try to publish any variable, whether numeric or text, the system simply ignores the command without displaying errors. For example:

      MQTT publish topic "coreS3/state", numeric or text variable, Qos 1

      If instead of a variable I use a fixed string, the command executes without issues.

      I have spent a lot of time trying to solve this, but I haven't found a clear answer. Has anyone faced a similar issue or has any suggestions on how to fix it?

      I appreciate any help you can provide.

      uiflow2_block_1745693328801.png

      [C:\Users\faria\Downloads\MQTT_Relay_S3_BAD.m5f2]

      felmueF 1 Reply Last reply Reply Quote 0
      • felmueF Offline
        felmue @Robertof
        last edited by

        Hello @Robertof

        hmm, using variables in MQTT publish works for me.

        How are you testing your code? Make sure your test software uses a different MQTT client id than your UIFlow2 code, else the first registered client gets kicked out.

        BTW: my example is in the Project Zone, named M5CoreS3_MQTT_4Relay_UIFlow2.2.5

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        R 1 Reply Last reply Reply Quote 0
        • R Offline
          Robertof @felmue
          last edited by

          @felmue Hello , Your code worked perfectly. I really appreciate the time and effort you put into helping me—it means a lot! Thank you!
          Roberto

          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