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

    Issue with vernemq mqtt broker

    Scheduled Pinned Locked Moved WiPy 2&3
    3 Posts 2 Posters 1.4k 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.
    • A Offline
      alfheim
      last edited by

      Hi

      I try to use vernemq with wipy.

      vernemq 0.14.1
      umqtt.simple (https://github.com/micropython/micropython-lib)
      wipy 2 board

      On the wipy board the following code

      from umqtt.simple import MQTTClient
      
      
      def main(server="192.168.1.150"):
          c = MQTTClient(b"ran", server)
          c.connect()
          c.publish(b"test/ran", b"hello")
          c.disconnect()
      
      
      if __name__ == "__main__":
          main()
      

      On the other side simple consumer in paho

      import paho.mqtt.client as mqtt  # The callback for when the client receives a CONNACK response from the server.
      
      
      def on_connect(client, userdata, rc):
          print("Connected with result code " + str(rc))
          # Subscribing in on_connect() means that if we lose the connection and
          # reconnect then subscriptions will be renewed.
          # client.subscribe("$SYS/#")
          client.subscribe('test/ran')
      
      
      # The callback for when a PUBLISH message is received from the server.
      def on_message(client, userdata, msg):
          print(msg.topic + " " + str(msg.payload))
      
      
      client = mqtt.Client()
      client.on_connect = on_connect
      client.on_message = on_message
      # client.username_pw_set('test01', password='test')
      
      client.connect("192.168.1.150", 1883, 60)
      
      # Blocking call that processes network traffic, dispatches callbacks and
      # handles reconnecting.
      # Other loop*() functions are available that give a threaded interface and a
      # manual interface.
      client.loop_forever()
      

      When I run the publisher, this is the error on wipy:
      Traceback (most recent call last):
      File "", line 12, in
      File "", line 6, in main
      File "/flash/lib/umqtt/simple.py", line 84, in connect
      IndexError: bytes index out of range

      In the vernemq error log:
      2016-11-06 20:46:13.121 [error] <0.583.0> CRASH REPORT Process <0.583.0> with 0 neighbours crashed with reason: no match of right hand value <<0,4,77,81,84,84,4,2,0,0>> in vmq_parser:parse/4 line 71
      2016-11-06 20:46:13.121 [error] <0.583.0> Ranch listener {{0,0,0,0},1883} terminated with reason: {badmatch,<<0,4,77,81,84,84,4,2,0,0>>}

      Please let me know if you need more details

      1 Reply Last reply Reply Quote 0
      • L Offline
        livius
        last edited by

        Is this "finalized" repo?
        I go to this repo and see many not implemented code
        "asyncio"
        "calendar"
        ...

        maybe you should ask repo admins about code?

        think about people first, then computers

        1 Reply Last reply Reply Quote 0
        • A Offline
          alfheim
          last edited by

          I did it, check this: https://github.com/micropython/micropython-lib/issues/115

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

          Pycom on Twitter

          Pycom