adventures with meshcore-cli

I have a good friend who is into meshcore. Seeking to expand the network he participates in, he asked me if I could host a repeater on the rooftop, to which I agreed.

He also gave me a little companion to connect so that I could also test and participate if I liked. The companion (a Heltec v3) was configured to use Bluetooth, but weirdly enough it was not searchable by my Apple devices and my Kubuntu device could pair with it, but could not actually use it. So I flashed it as a USB companion instead. Which now bore the question: How do I use the thing?

With a little help from Perplexity, since I knew nothing about Meshcore until this time, and it was not in my interests horizon, here’s how you can use a meshcore USB companion from the command line:

  • You install the Python meshcore and meshcore-cli packages, preferrably in their own dedicated Python environment. You now have a meshcore command at your disposal
  • You plug in the companion. Locate where it is available (dmesg maybe?). Mine was recognized as /dev/ttyUSB0. You can now connect to it with meshcore /dev/ttyUSB0
  • You are greeted with a prompt and you can now start searching for repeaters to connect to. Before you do that, you need to set the time on the companion (it does not read your computer’s clock). So take the output from date +%s and at the companion prompt type time 1780814625 (actually the epoch you get).
  • Now you can set the name (set name my_companion) of your companion and send a flood advertisment (floodadv) to be discovered.

My friend also proivided me with a meshcore:// URL and a password to be able to connect and manage the repeater. So I used import_contact meshcore://... and then used list to check whether the contact was imported. Sure enough it was there. Using login contact_name password I was able to send commands to the repeater. The most important one in our case was to set the flood interval: cmd contact_name "set flood.advert.interval 6".

If all goes well, you can wave hello to the other in the public channel with public Hello, World and watch the screen of your terminal as the rest wave back at you.

I don’t know whether I’ll stay involved in this thing, but it was a fun excursion.

Leave a comment