Pybytes Downlink Messages



  • 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.



  • 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



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



  • 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


Log in to reply
 

Pycom on Twitter