I made a post not too long ago about releasing a Go API that anyone can use to interact with meshtastic radios. My ultimate goal in making this was to create a new CLI that would work without any dependencies (like Python) to help when running tests on the radios. The only thing that’s needed to get it up and running is to download the appropriate executable, make sure the drivers are installed (Mac OS and Windows) and execute the command! It’s not quite at feature parity with the Python CLI, but I think the most important components are all available. I’ve tested it on Mac OS (Big Sur), Windows 10 and Raspberry Pi OS without any issues.
The repository for the tool is here on Github with the latest executables available for download here. Feel free to kick the tires and let me know if there are any problems!
Thanks for the feedback! It’s pretty easy to add more supported systems to the releases. If you’d like to have an executable for any system in particular let me know and I can add them to the current version!
The TCP connection is next on my list of upgrades, I’ve just been cleaning up some bugs with this version before starting new development.
I’d find an x86 Linux version more valuable, but since my node is hanging from a window, I’d prioritize the TCP transport first. I’m not particularly keen on taking it down from my window to plug it into my PC.
I don’t blame you on not wanting to take it down from a window . I have a new release out here that includes TCP communications. All you need to do is the pass the IP of the radio in the --port flag and it will communicate with it over TCP. If you try it out feel free to let me know if you run into any issues!
So I tried it out on my Windows laptop – I see you’ve added Linux x86_64 as a supported target. Any chance you’d be willing to add a Linux x86 (32-bit), too?
Some feedback:
It appears TCP is used for the transport if --port is given an IP address. It would be good to support hostnames (and ports? --address hostname:port|--address hostname|--port devicename) as well; the Meshtastic firmware advertises a hostname (i.e. through the ESP-IDF DHCP client), which many wireless gateway firmwares respect. Of course, if the option --port is shared between (arbitrarily named) local serial ports and (arbitrarily named) TCP/IP hosts, you can end up with some interesting behavior (say, hostname of ttyUSB2, or a symlink to a serial port named 10.0.0.1); it’s probably better to make the transport an explicit choice.
The message recv command doesn’t behave the way I’d expect them to, based on the help messages. It looks like the message recv command requires the --exit ‘option’; without it, the command prints the help message. However, the --help message indicates that -e / --exit defaults to false; the behavior of message recv --exit false (waits for a message) differs from message recv (prints help message).
The --help switch (on all the commands?) says that its default is “false” (?), but setting it to true or false doesn’t change anything – the help message is always displayed. I’m guessing this is an oddity of whatever library you’re using for parsing the command line.
The info command seems to be much slower than the equivalent in the Meshtastic Python CLI. Not exactly sure why this is the case since I didn’t rummage through the source code. (Is it fetching each set of information on a separate TCP/IP connection?)
I think I found a bug while running info. See below.
This is an easy change, I’ll include it in the next release. That use case makes sense to help make the CLI more reliable for more edge cases.
This is a bug I introduced in my last release. It will be fixed in the next release
The help command is built in from the CLI package I’m using. I’ll check into passing it a value
The info command is slower now because of a difference in how Go handles TCP sockets. I found I had to set an explicit timeout since the FromRadio packets don’t announce in a consistent way when they end. I’m planning on seeing how I can lower this timeout in the future.
That is indeed a bug as well! I’ll take a look and include the fix in the next release.
For what it’s worth, I’m not sure anyone’s crazy enough to try to pass in --help true or --help false except just to try to break it. But it is a little odd that --help accepts a single argument.