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

    m5Dail MQTT and Wifi Help

    UiFlow 2.0
    5
    9
    2.9k
    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
      iosapps420
      last edited by iosapps420

      Please i need some help to set up a simple MQTT to send and receive messages
      i bought the M5Dail over 3 months ago and i still cant use it, i keep getting all kind of errors, i updated to the latest firmware and its still not working
      0_1708954894539_035d4811-b035-40af-9721-fe7ed27e15ef-image.png

      then i get these errors, including on the screen
      0_1708954943111_7060e1fc-a12d-4b69-86ef-51551794e3e1-image.png

      Edit: Even if i try to just setup a simple WIFI client, i get this error
      Traceback (most recent call last):
      File "<stdin>", line 22, in <module>
      File "<stdin>", line 15, in setup
      OSError: Wifi Internal Error

      Can anyone please post your flow of a working MQTT?
      thank you

      1 Reply Last reply Reply Quote 0
      • robskiR
        robski
        last edited by robski

        I'm using external Hive MQTT and it didn't worked with build in blocks for mqtt on my M5Dial so had to use "execute code" way and it was fine

        add wifi config to your code too

        M5StickC, M5StickCPlus, M5StickCplus2,M5GO, M5Core, M5Tough, M5Core2, M5 Demo Board, M5Dial, M5Paper, M5Atom, M5Cardputer, M5StampS3, CoreMP135, StamPLC, AirQ

        1 Reply Last reply Reply Quote 0
        • ajb2k3A
          ajb2k3
          last edited by ajb2k3

          I posted an example in UIFlow2’s project zone for the atom. I found the issue is with the placement of the MQTT unit block

          The error says the host is unreachable, are you sure you have the correct address?

          UIFlow, so easy an adult can learn it!
          If I don't know it, be patient!
          I've ether not learned it or am too drunk to remember it!
          Author of the WIP UIFlow Handbook!
          M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

          1 Reply Last reply Reply Quote 0
          • I
            iosapps420
            last edited by

            Thank you for the quick replies, i think i managed to make it work, it seemed to be an issue with WIFI
            now i can publish messages everytime i rotart the dial, but the new issue i'm having is receiving messages (or in other words Subscribing)
            below is a sample bock code, i would receive one message then it stops receiving.
            do you know the block "MQTT Apply For Messages" what is it used for? if i add it i would receive one message, i tried adding in the subscribe blocky but then i cant publish, any idea what i'm doing wrong?

            0_1708957753002_163b591b-6414-4efe-a6d6-ae2fe9c68705-image.png

            robskiR 1 Reply Last reply Reply Quote 0
            • robskiR
              robski @iosapps420
              last edited by

              @iosapps420 said in m5Dail MQTT and Wifi Help:

              Thank you for the quick replies, i think i managed to make it work, it seemed to be an issue with WIFI
              now i can publish messages everytime i rotart the dial, but the new issue i'm having is receiving messages (or in other words Subscribing)
              below is a sample bock code, i would receive one message then it stops receiving.
              do you know the block "MQTT Apply For Messages" what is it used for? if i add it i would receive one message, i tried adding in the subscribe blocky but then i cant publish, any idea what i'm doing wrong?

              0_1708957753002_163b591b-6414-4efe-a6d6-ae2fe9c68705-image.png

              are you publishing and subscribing to same topic or two different so something else is acting for topic you subscribing?

              M5StickC, M5StickCPlus, M5StickCplus2,M5GO, M5Core, M5Tough, M5Core2, M5 Demo Board, M5Dial, M5Paper, M5Atom, M5Cardputer, M5StampS3, CoreMP135, StamPLC, AirQ

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

                Hi guys

                please find my M5Dial MQTT (subscribe and publish) example called M5Dial_WiFi_MQTT_UIFlow2.0.1 in the UIFlow2 Play Zone.

                BTW: MQTT apply for messaging (e.g. mqtt_client.wait_msg() block is a blocking call, e.g. it waits until a message is received. If you only want to check for new messages (non blocking) you'll need to use an Execute mpy code block with mqtt_client.check_msg() in it.

                Thanks
                Felix

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

                1 Reply Last reply Reply Quote 0
                • I
                  iosapps420
                  last edited by

                  @felmue said in m5Dail MQTT and Wifi Help:

                  M5Dial_WiFi_MQTT_UIFlow2.0

                  Thank you all very much
                  @felmue your example worked perfectly, i really appreciate it

                  1 Reply Last reply Reply Quote 0
                  • I
                    iosapps420
                    last edited by iosapps420

                    This post is deleted!
                    1 Reply Last reply Reply Quote 0
                    • J
                      jimbol
                      last edited by jimbol

                      Hi, I am trying to get MQTT to work on M5Dial, I started using uiflow2 and building myself, I have made it work in the past with a Core2 and UIFlow, but no luck yet with UIFLOW2 and the dial.

                      Using the M5Dial_WiFi_MQTT_UIFlow2.0.1 example from @felmue I can get it to work, but if I change the subscribe block to display the MQTT message, or to set a variable to get message(return bytes), I get the following error:

                      File "umqtt/simple.py", line 114, in connect
                      MQTTException: 2

                      Can anyone help?

                      Further info: I have found that this is actually from the broker side. If I restart the broker, it will connect fine, until I power cycle, or reset. The second connection fails.

                      Solution: I ended up changing libraries to PicoMQTT and was able to get everything working.

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post