🤖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

    UiFlow 2.0
    2
    3
    308
    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
      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
        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
          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
          • First post
            Last post