Python API release notes

Hi ya’ll,

I’m going to need this API soonish for some of my personal projects. So I’m going to make a quick tiny python library. Anyone want to be the ‘owner’ of that library after the initial version is working. i.e. extend it per your desires, fix bugs etc?

It will be out on PyPi, so people will just need to “pip install meshtastic-python”

Early notes here:

we would need the Python API for the FreeTakServer

ok - I need it anyways for stress testing a bunch of nodes (and seeing if I ever drop packets etc…) So I just did the device side code for the ‘easy’ python API. There should be something you can use in a couple of weeks.

1 Like

Ok - a first cut of the python client API is out:

Any feedback appreciated. You’ll need to run device software version 0.6.0 or later.

It includes a “meshtastic” command line app which should work on windows, os-x and linux and it lets you see all of the messages the radios send to the host. Soon you’ll also be able to use this commandline tool to change all the various device options that the android app doesn’t have a GUI for yet.

1 Like

New version of the python API released. Includes more documentation and examples.

Also - the associated command line tool lets you set all the options of the devices (including options that don’t yet have a spot in the Android GUI).

1 Like

This is very nice. For range testing i connect one device to my computer and run this script on it:

import meshtastic
import time
interface = meshtastic.StreamInterface()
while 1:
   str = time.strftime("%a, %H:%M:%S", time.gmtime())

Each minute i get a notification on the device i bring on my walk. It is easy to see when you get out of range. So far i have only been 1 km out and had no missed messages.


cool idea.

btw - received Snr is included in the packets provided to the API, so you could log that as well.

Also, there is a want_response bool which can be set in those text message packets which will cause the receiving device to reply with its position and implicitly you will get snr there so you can log it if you wish. The python api doesn’t have a way to set that flag right now, but I’ll add that today.

In case it is useful for your efforts:


@claesg Nice script!

As @geeksville updates the want_response to the code, you could not only get the SNR’s logged on the stationary node, but you could also make your stationary node send the SNR and timestamp, inside your str notification, to your mobile node, of your last response from your mobile node. This might also work with want_ack flag (although you loose position information).

1 Like

0.6.7 - minor update to make the python library ready for the last bit of device firmware changes (coming next week)

0.9.2 released to fix:

1.0.2 has been released to cleanly exit if the serial/USB port is simply unplugged

1.0.3 contains fixes to the example and minor changes to exceptions to make errors clearer.