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

    Pybytes Downlink Messages

    Scheduled Pinned Locked Moved Support & Troubleshooting
    4 Posts 4 Posters 169 Views 5 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.
    • M Offline
      mcallistertad
      last edited by

      Is there a way to receive messages from pybytes? I don't see anything documented but it would be nice to enable control on the app layer.

      Something like:

      pybytes.receive_signal(topic, data)
      

      or even have send_signal return the last message posted to the topic when called.

      J 1 Reply Last reply Reply Quote 0
      • J Offline
        jirkakrepl @mcallistertad
        last edited by

        Hi @mcallistertad,

        I agree. Currently, there's no way to do it. We will discuss today and probably implement this functionality.

        On Wi-Fi/ LTE Cat m1 we could send any downlink messages over mqtt.

        on LoRa/Sigfox we need to do something else - we are constraint by bandwidth and downlink connection windows

        software developer @ Pycom

        Have you checked out our docs for the answer? (Now with an easy search function) https://docs.pycom.io

        Check out our newly revamped device management platform, Pybytes! https://pybytes.pycom.io/

        1 Reply Last reply Reply Quote 1
        • C Offline
          Carl Folkesson
          last edited by

          Hi @jirkakrepl,
          Any update on downlink functionality over Wi.Fi/LTE?

          ahmadelmasriA 1 Reply Last reply Reply Quote 0
          • ahmadelmasriA Offline
            ahmadelmasri @Carl Folkesson
            last edited by

            Hello @Carl-Folkesson,

            On the latest Pybytes firmware we have implemented the downlink feature over MQTT.

            Steps:

            • Once the device is activated
            • pybytes.set_config('pybytes_autostart', False)
            • in your main.py you have to initialize pybytes
            • To send a JSON string via MQTT to the device, you need to use topic d+<device_id>
            • The message should start with 0x08h + MESSAGE example: To send {"test":"value"} the hex code is: 087b2274657374223a2276616c7565227d

            main.py Test Code:

            
            def callback_function(message):
                print(message)
            
            
            if (len(pybytes_config['username']) > 4 and len(pybytes_config['device_id']) >= 36 and len(pybytes_config['server']) > 4):
                from _pybytes import Pybytes
                pybytes = Pybytes(pybytes_config, user_callback=callback_function)
                if pybytes.connect_wifi():
                    # SEND PING
                    pybytes.send_ping_message()
            
                    # SEND DEVICE'S INFORMATION
                    # The INFO message should always be sent, otherwise, Pybytes could not be aware
                    # of some important information regarding this device, like its firmware version.
                    pybytes.send_info_message()
            
                    # ENABLE TERMINAL
                    # This should always be enabled if you're using firmware that is compatible with the pybytes terminal.
                    # The terminal messages will use the virtual pin (or signal) 255.
                    pybytes.enable_terminal()
            
                else:
                    print("Failed to connect to Pybytes! Invalid credentials or network issues?")
            else:
                print("Could not load Pybytes configuration!")
            
            

            NB: Kindly note that this is still experimental.

            Let me know if you face any errors.

            Have a nice day.

            Best Regards,
            Ahmad El Masri

            Ahmad EL Masri

            1 Reply Last reply Reply Quote 1

            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