Fake radios
A Meshtastic radio and a MeshCore one that transmit nothing, anywhere: to try meshctl, or your own app, with no radio, or without risking one. Your app reaches them over the network as it would a real one, and you decide what the mesh around them says and does.
What they are
Two programs, fake-meshtastic and fake-meshcore.
Each listens on the port a real radio on the network does and speaks
its protocol, as its firmware's own source has it: the Meshtastic one
hands its clients every setting and module, answers admin requests and
keeps what it is told to change; the MeshCore one is a companion radio
with its contacts, channels, queued messages, rooms and repeaters to
log in to.
Around them, a mesh you set up as you like:
- Nodes that answer when asked, or now and then, or never; reached directly, through hops or by MQTT; with a route of their own for a traceroute.
- A crowd of up to a thousand nodes, for lists and maps to be full.
- Scenarios: conversations, direct messages, waypoints, telemetry over hours, a Store & Forward router; set up at once and undone whole.
- A panel in the browser, a command line and an API, to do it by hand or from a script.
They are meant for work and tests, demos and screenshots. A real radio still has the last word: what the fakes do is what meshctl's authors read in the firmware.
Getting them
Each release
brings an archive with both, meshctl-fakes-*.tar.gz, for
Linux (x86_64 and aarch64, static, any distribution) and macOS (Apple
silicon and Intel). Each program is one file, its panel and scenarios
inside; beside them, an example of each node's file and their full
reference.
tar xzf meshctl-fakes-*-x86_64-unknown-linux-musl.tar.gz
cd meshctl-fakes-*/
./fake-meshtastic --config examples/meshtastic.toml
The Meshtastic radio listens on port 4403 and the MeshCore one on 5000,
as real ones; each answers its API, and its panel, on the port after
it, 4404 and 5001. Other ports go after, as
./fake-meshcore 5100 5101. With no --config,
each starts as a radio of its own with a few nodes; the examples
add a crowd of fifty.
Then add it to meshctl, or to your app, as a radio on the network:
127.0.0.1:4403 or 127.0.0.1:5000. Its panel is at
http://127.0.0.1:4404 or :5001; it listens on
your machine alone unless its file says otherwise.
From the source, with Rust:
cargo run -p meshctl-fakes --bin fake-meshtastic.
The panel
A terminal in the browser, laid out in five sections on keys
1 to 5, with what the radio says as it goes in
a drawer beside, on `. Light, dark or as the system is.
state shows how the radio is, who it is and where, on a map, its battery and how busy it hears the channel, to change; events, all it said, to filter.
The command line
At the foot of the panel, fake> takes everything the
panel does as a line. It suggests as you type: Tab
completes, the arrows go through the suggestions, and
Enter takes the one picked and does it once nothing it needs
is missing. help lists every command, scenario and key.
run lab the lab's nodes, around A Coruña
run chat 1 a scenario, on channel 1
say #1 as OSCR hello, everyone a node says something on a channel
say #1 as OSCR at=-3d long ago …heard three days ago
react #1 👍 as OSCR …and reacts to the last message
node Ana* answers=always nodes picked by name, changed
node add long_name=Ana hops_away=1
radio pos 43.36 -8.41 where the radio is
crowd 200 a crowd of two hundred
undo the last scenario, and all it brought
The same program is a command line for a radio running: it says the line to its API and prints what it did. With no line, it reads one per line, as a script, and ends with an error if any went wrong.
./fake-meshtastic do run chat 1
printf 'crowd 50\nrun dms\n' | ./fake-meshtastic do
./fake-meshcore do --api 192.168.1.20:5001 advert repeater
Scenarios
A scenario brings the nodes it needs, counts on nothing the radio has, and is undone whole, taking away what it brought. The radio's own commands are done at once, with no undo.
| Meshtastic | What it does |
|---|---|
chat <slot> | Five nodes talk on a channel, heard every way: directly, through hops, by MQTT; when you write there, two react and one answers. |
past <slot> | A node heard on a channel over the last year, for a conversation to show its days. |
dms | Nine nodes write to the radio directly. |
waypoints <slot> | Three waypoints shared on a channel: open, locked, and one that expires. |
history <hours> | A weather station's telemetry over the last hours, for charts. |
storeforward | A Store & Forward router and its heartbeat. |
crowd, telemetry, position, waypoint, heartbeat, trace, drop | Its own commands: a crowd, a node's telemetry or position, a waypoint, a traceroute, the link dropped. |
| MeshCore | What it does |
|---|---|
chat <slot> | Four people talk on a channel, heard passing through repeaters; when you write there, one answers. |
advert, crowd, trace, drop | Its own commands: a node never seen advertises, a crowd of contacts, someone else's trace heard going by, the link dropped. |
Your own scenarios
A scenario is a TOML file: what it takes, the nodes it brings, what
they do at times, and what they do when something happens, as a client
writing or connecting. Put yours in the directory the node's file names
in [fake] scenarios: the panel lists them first, and they
are set up and undone as the radio's are.
name = "hello"
help = "A node greets a channel, and answers whoever writes there."
undo = "its node"
[[arg]]
name = "slot"
type = "slot"
[[node]]
as = "ana"
long_name = "Ana"
hops_away = 1
[[step]]
at = "1s"
do = "say #{slot} as {ana} hello, anyone?"
[[on]]
heard = "#{slot}"
do = "reply #{slot} as {ana} I read you: {text}"
The radios' own scenarios are written so too, in fakes/scenarios, to read as examples; the reference has every key.
The node's file
With --config, the radio starts as a TOML file says: its
name, channels, LoRa, position and every setting a real node has, and
a [fake] section with what only a fake radio has: its
ports, where its API listens, its scenarios' directory, the nodes it
sees, each with how it behaves, and what it does as it starts.
- Meshtastic takes the shape of what the official CLI exports,
meshtastic --export-config: a real node's export, turned into TOML, starts the fake radio as that node. - MeshCore names its settings as
meshcore-cli'ssetdoes, its channels slot after slot.
[fake]
port = 4403
api = 4404
listen = "0.0.0.0"
scenarios = "scenarios"
[[fake.start]]
scenario = "lab"
[[fake.node]]
long_name = "Lab neighbour"
short_name = "NBR"
hops_away = 0
answers = "sometimes"
A real node's export carries its Wi-Fi and MQTT passwords and its keys: keep it to yourself. The panel's node downloads the radio as it is now as such a file, to start it so again.
The API
Both radios answer the same API, the one the panel uses: its reference
is at /docs on each, and the OpenAPI document behind it at
/openapi.json.
/commanddoes a line, as the command line takes it;/command/completesays how a line may go on./scenariossets them up and undoes them./nodes,/chats,/nodeand/radio: the nodes it sees, its conversations, the node it is and how it goes./eventsfollows all it says as server-sent events, or answers it as JSON, by kind and waiting for it: what clients sent and were answered, byte for byte, for tests to check.
curl -X POST http://127.0.0.1:4404/command \
-H 'Content-Type: application/json' -d '{"line": "run chat 0"}'
The crowd
crowd fills the radio with as many nodes as you ask for, up
to a thousand on Meshtastic, and as many as a MeshCore radio has room
for. Each is named as people name theirs, with no numbers: a name, a
town and an adjective, two at a time, as Uxía Arteixo,
Misty Lugo, Quiet Antía or Rusty Muros, over
fourteen hundred of them, with a router's Relay or a MeshCore
repeater's, room's or sensor's kind after it.
Of every role and many models; heard directly, through up to seven hops or by MQTT; minutes, days, weeks or months ago; most where they say, each near the town in its name, some nowhere and a few on the same spot. The same each time for the same number, so that what you saw once is there again.