OTA Update of Python Code

Using Xbee3 Cellular Modem.

Is it possible to update python code over the air? Is this something Digi Remote Manager can handle?


P.S. The “Upload Python Files” option is not available under the “More” menu for the device.

1 Like

This is scheduled for an upcoming release of the XBee Cellular firmware.

Edit: This feature (transfer files to device via Remote Manager) is in the current XBee/XBee3 Cellular firmware releases.

Is there any timeline for that upcoming release?

When can we expect this to happen? I do not want to go through the Digi Remote manager server.

The feature exists in Digi Remote Manager. You could use the urequests module to download content to the file system from a web server if you’re looking for a way to download code over-the-air.

Is there any proper implementation of this ?
Given that the device can only run main.py or main.mpy file located in the flash.

Is there a sample code where a file was successfully downloaded using urequests ?
For a simple sample code like the following:

import urequests

url = ‘https://www.python.org/static/opengraph-icon-200x200.png

download the url contents in binary format

r = urequests.get(url)

open method to open a file on your system and write the contents

with open(“python1.png”, “wb”) as code:

I am getting:

TypeError: function takes 2 positional arguments but 4 were given

It sounds like you aren’t using Digi’s version of urequests. Try uploading this one to your device – your test code worked for me. https://github.com/digidotcom/xbee-micropython/tree/master/lib/urequests

Thanks a lot for your kind reply. I wasted a day on this :frowning:

Sorry to hear that. :frowning:

Please take a look at the PyCharm plugin (described in the README from that GitHub project) for developing code on the XBee3 products. The GitHub project includes libraries ported to the version of MicroPython on XBee modules. In this case, the TLS/SSL interface is slightly different than other MicroPython products.