# CLI Commands The text CLI of every ZephCore role. Commands are sent over USB serial (CDC-ACM); repeaters and room servers also take them remotely over the mesh from an admin. Commands sent remotely (non-zero `sender_timestamp`) cannot access USB-only commands. A command sent over the mesh to a repeater or room server must be printable text (UTF-8, tabs and line breaks included); one holding other control characters is dropped without a reply. | Role | Which commands apply | |------|----------------------| | **Repeater** | Every section except Room Server, the two Companion sections and Observer | | **Room server** | Shares the repeater's CLI — the common commands (radio, region, password, advert, gps, etc.) plus `setperm` / `get acl` — and adds `room.post` | | **Companion** | The common commands (`helpers/CommonCLI.cpp`) from USB or the app's CLI, plus Companion BLE, Companion WiFi and Companion Extras. The repeater's and room server's own commands (`setperm`, `get acl`, `discover.neighbors`, `uplink.*`, `room.post`) are not there. Over the mesh, a contact with remote CLI permission reaches only the commands upstream's companion has | | **Observer** | Its own small CLI, USB only — see [Observer](#observer-zephcore-only). No other section applies | **Sources:** - `helpers/CommonCLI.cpp` — common commands shared by all roles - `app/RepeaterMesh.cpp` — repeater-specific commands (`setperm`, `get acl`, `region`, `discover.neighbors`) - `helpers/CommonCLI.cpp` `handleRegionCmd()` — the `region` sub-CLI (as upstream); the `region load` line reader stays in each role - `app/RepeaterUplink.cpp` — `get`/`set uplink.*` (ESP32 uplink builds only) - `app/RoomServerMesh.cpp` — room-server-specific commands (`room.post`) - `src/main_companion.cpp`, `app/PowerPolicy.cpp`, `app/CompanionWifi.cpp` — companion-only commands (`v.*`, `autoshutdown`, `help`, `wifi.*`) - `app/ObserverMesh.cpp` `handleCLI()`, `app/main_observer.cpp` — the observer's CLI and its `help` banner > **Commands are case-sensitive**, matching Arduino MeshCore. Nothing is lower-cased before matching. > **ZephCore-only commands** are tagged *(ZephCore only)*: Arduino MeshCore has no command of that name > (checked against its `dev` branch at `3e3150c8`, 2026-10-04). A section whose heading carries the tag is > ZephCore-only as a whole. Untagged commands exist upstream; where their replies, limits or behaviour > differ here, the description says so. > **Request-tag prefix.** If a command is longer than 4 characters and its **third** character is `|` > (e.g. `a7|reboot`), the first three characters are stripped before dispatch and echoed back at the > start of the reply. This is how the phone app correlates replies with requests. It means a command > whose third character is a literal `|` cannot be sent as-is. --- ## System | Command | Description | |---------|-------------| | `ver` | Firmware version and build date | | `board` | Board manufacturer name | | `power` | Power sources, as upstream: `batt: mV usb: solar_chg: ext: charger:`. `usb` is the nRF52 VBUS detect (`n/a` on other chips); no board reports a solar-charger or charging line yet, so `solar_chg` is `n/a` and `charger` is `no` everywhere. `ext` is the same signal the low-battery shutdown checks | | `reboot` | Reboot immediately | | `poweroff` / `shutdown` | Power the node off, as upstream: GPS, sensor and buzzer rails off, LoRa held in reset, then System OFF (the power latch released first on soft-power boards). Wake with the user button (nRF) or a power cycle — a node without a reachable button stays off until someone gets to it, so think twice before sending it over remote admin. The shutdown reason `User Request` is recorded for `get pwrmgt.bootreason`. Replies `OK - powering off`; deferred like `reboot` | | `start dfu` | *(ZephCore only)* nRF52: reboot into the UF2 bootloader for drag-and-drop update. ESP32-S3: reboot into the ROM download mode on USB-Serial-JTAG (`303a:1001`), so ordinary `esptool write-flash` and browser flashers can reach the chip. Every other chip replies with an error and does **not** reboot — ESP32-C3/C6 and classic ESP32 never lose the port to USB OTG so esptool resets them itself, and nRF54L15/MG24/STM32WL have no USB device peripheral and are flashed over SWD | | `start ota` | nRF52: reboot into BLE OTA DFU mode. ESP32 repeater (S3/C-series): start the WiFi AP + HTTP OTA server, `Started: http://192.168.100.1/update`. ESP32 companion built with `--sysbuild` (releases; not the Heltec V3, Wireless Tracker or the C6 boards): open the BLE OTA window, `BLE OTA open for 600 s`; a passkey-bonded nRF Connect Device Manager uploads `-update.bin` and resets the node; the window stays open while an upload runs. Again while open: `BLE OTA already open ( s left)`. Every other build replies `Err: no OTA in this build - flash over USB` and does **not** reboot | | `stop ota` | *(ZephCore only)* ESP32: stop the WiFi OTA server (`OTA stopped`) or close the BLE OTA window (`BLE OTA closed`); `OTA not active` when nothing is open, `Not supported` elsewhere | | `clkreboot` | Set clock to a fixed reference time (15 May 2024 8:50pm UTC) then reboot. The one command that moves the clock back at once. On a board with a hardware RTC the reference time is written to the chip too, as upstream, so the reset survives the reboot | | `powersaving` / `powersaving on` / `powersaving off` | Upstream's command and replies. On ESP32 light-sleep builds (repeaters of boards with `light_sleep: true`, companions of boards with `light_sleep_companion: true`) it gates light sleep: `off` (persisted) keeps the SoC awake, which also keeps a USB Serial/JTAG console attached; `on` allows sleep again, replying `on - After N s (console window)` while the console window is open, else `on - Immediate effect`. Default **on** on those repeaters, and prefs from firmware that stored the field without acting on it are read as on once. Default **off** on companions: a companion sleeps only after `powersaving on`, and then not while a USB host is attached, the display is on, or a Bluetooth link is not yet encrypted. nRF52/nRF54L: stored, replies `on - Immediate effect` (they always idle in System ON; `off` changes nothing). Other boards: `Board not supported` | --- ## Clock | Command | Description | |---------|-------------| | `clock` | Display current UTC time | | `clock sync` | Sync clock from the sender's timestamp. A later time is set at once; an earlier one is slewed (the clock runs at 11/12 speed until it matches, so it never goes back; reply `OK - clock slewing back s`), unless it is before the firmware's build day (`ERR: clock cannot go before the build day`). Arms the 7-day mesh-time-sync suppression window. | | `time ` | Set RTC to a specific Unix timestamp. A later time is set at once; an earlier one is slewed as for `clock sync` (reply `OK - clock slewing back s`), unless it is before the firmware's build day (`(ERR: clock cannot go before the build day)`). Arms the 7-day mesh-time-sync suppression window. | Every clock set (these commands, GPS, the app, mesh time sync, SNTP) is also written to the board's hardware RTC when it has one, so the time survives a power-off. --- ## Advertisement | Command | Description | |---------|-------------| | `advert` | Send a flood-routed self-advertisement (1500 ms delay) | | `advert.zerohop` | Send a 0-hop (direct only) self-advertisement | --- ## Neighbors | Command | Description | |---------|-------------| | `neighbors` | Display current neighbor list | | `neighbor.remove ` | Remove a neighbor entry by its public key. A prefix is accepted — the hex is truncated to at most 32 bytes and matched at whatever length you give. **Repeater only in effect:** `RoomServerMesh` does not override `removeNeighbor`, so on a room server this replies `OK` and does nothing. | | `discover.neighbors` | *(repeater only)* Broadcast a node discovery request to find nearby nodes; responses are collected for 60 s (as upstream `bf9c6cb5`). Takes no arguments — anything after it replies `Err - discover.neighbors has no options`. A repeater with `repeat off`, or with both advert intervals at `0` (a hidden node, as upstream `f19733e4`), does not answer. Not implemented on room servers. | --- ## Security & Access Control | Command | Description | |---------|-------------| | `password ` | Set the admin password (**max 15 characters**). An empty one is refused: a stored empty admin password matches no login, so admin is then only reachable through the ACL (`setperm`) or the serial console | | `setperm ` | *(ZephCore only)* Set ACL permissions for a node (app format: 2-char hex perms first). A small-order key (the all-zero key among them) is refused with `Err - invalid params` | | `setperm ` | Set ACL permissions for a node (Arduino format: pubkey first, decimal perms) | | `get acl` | *(USB only)* List all ACL entries, as upstream: `ACL:` then one ` ` line per entry, printed straight to the console (the ` -> ` reply line is empty). Guest entries (permissions 0) are skipped. | > **Password length:** admin and guest passwords are capped at **15 characters** (16-byte storage incl. NUL; same limit as Arduino MeshCore). The login-send path silently truncates anything longer, so a password >15 chars will never authenticate. Applies to `set guest.password` as well. > **`allow.read.only` is room-server only.** `RoomServerMesh.cpp` is its sole consumer; `RepeaterMesh.cpp` never reads it, so on a repeater the setting silently did nothing. The CLI now only exposes it on `CONFIG_ZEPHCORE_ROLE_ROOM_SERVER` builds — a deliberate divergence from Arduino MeshCore, whose shared CommonCLI offers the knob on every role. The pref itself is unchanged: it stays byte 114 of the on-flash prefs layout, identical to Arduino's, so existing prefs files are unaffected. > **Guest access differs by role, matching Arduino MeshCore.** On a **repeater**, an empty `guest.password` (the default) means *open* guest access — a blank submitted password logs in as `PERM_ACL_GUEST`, which cannot run CLI commands or read the access list, so it gets login plus status/telemetry only. On a **room server**, an empty `guest.password` *disables* guest login, so a room is never accidentally left open; to run an open room use `set allow.read.only on`, which grants read-only (`PERM_ACL_GUEST`), not post rights. Set a non-empty `guest.password` to require one on either role. On both roles a login only ever raises a client's role, never lowers it; lowering is `setperm`'s. --- ## Room Server | Command | Description | |---------|-------------| | `room.post ` | Post a message to the shared room as the server itself (system post). Pushed to clients like any other post. | | `set repeat on` | Replies `ERR - repeat now deprecated`, as upstream (1.18.0): a room server never forwards other nodes' packets. `set repeat off` and `get repeat` are the common commands | --- ## Region Filtering Regions control which flood packets the repeater forwards. The region tree is hierarchical; the wildcard `*` region is the root. | Command | Description | |---------|-------------| | `region` | Export the current region map (indented text tree) | | `region load` | Enter interactive region load mode. Paste indented region lines; send a blank line to commit. Any unindented command (e.g. `reboot`) aborts the load without committing, and then runs | | `region save` | Save the current region map to persistent storage | | `region def [...]` | Cursor-walk bulk region builder — define a hierarchy in one line (see below) | | `region put []` | Create a region; default parent is the wildcard root. Flood is **allowed** by default (use `region denyf` to deny) | | `region remove ` | Remove a region (must have no children) | | `region get ` | Show a region's parent and flood-allow flag | | `region home []` | Get (no arg) or set the home region | | `region default [\|]` | Get (no arg), set, or clear (``) the default flood scope. Originated floods (self-adverts, etc.) are scoped with this region's TransportKey. Auto-creates the region if it doesn't exist and persists immediately | | `region allowf ` | Allow flood packets in a region (clears deny-flood flag) | | `region denyf ` | Deny flood packets in a region (sets deny-flood flag) | | `region list allowed` | List all regions that allow floods | | `region list denied` | List all regions that deny floods | **Un-scoped floods:** plain floods, and transport floods whose first code is `0` (no region computes `0`; as upstream 1.18.0). The wildcard `*` decides them: `region denyf *` stops forwarding them, and `flood.max.unscoped` limits their hops. Upstream applies neither to the code-`0` case; ZephCore applies both. A reply to such a request is sent un-scoped. **Region load format:** one region per line, indented with spaces to indicate depth. Append `F` after the name to mark flood-allowed (otherwise flood is denied by default). **`region def` format:** space-separated tokens; a cursor starts at `*`. Each token is `name` (create child of cursor, advance cursor to it) or `name|jump` / `name,jump` (create child of cursor, then move cursor to the existing region `jump`). Does **not** auto-save — follow with `region save`. Reply is the updated region tree. Example — branched tree: `region def west pnw or pdx|pnw wa sw-wa`. Example — flat list: `region def west|* pnw|* or|* pdx|*`. --- ## Statistics & Logging | Command | Description | |---------|-------------| | `clear stats` | Reset all statistics counters | | `stats-core` | *(USB only)* Display core mesh statistics | | `stats-radio` | *(USB only)* Display radio statistics | | `stats-packets` | *(USB only)* Display packet statistics | | `log start` | Enable packet logging to file | | `log stop` | Disable packet logging | | `log erase` | Erase the log file | | `log` | *(USB only)* Dump the full log file to USB serial | | `erase` | *(USB only)* Factory reset: erase the entire LittleFS volume, the BLE-bond NVS, and external QSPI flash, then reboot | > **`erase` is a true factory reset.** It flattens `lfs_partition` (identity, prefs, ACL, > region map, logs), `storage_partition` (BLE bonds) and `qspi_storage_partition` where > present — not just the files under `/lfs/repeater/`. The node comes back with a new > identity and default prefs. Erasing the volume rather than unlinking files is what makes > it able to recover a volume another firmware has written into: on nRF52840 the Adafruit > core's filesystem (used by Arduino MeshCore and Meshtastic) sits at 0xED000, inside our > `lfs_partition`, and its format scribbles the top 7 blocks of our volume. Switching > between Arduino-core firmware and ZephCore on nRF52840 needs an erase in **both** > directions — `tools/formatter` or a full chip erase. --- ## GPS | Command | Description | |---------|-------------| | `gps` | GPS status, upstream's form (1.18 GPS rework, `6c9600e1`): `> on, , , ` or `> off, `. Activity: `active` (acquiring), `waiting` (asleep between duty-cycle fixes), `inactive`. Last fix: `N sats ago` or `no fix` (age in `s`, `m` or `h`, rounded down). Mode: `continuous` or `periodic (Ns)` (`gps period`). `Error, gps provider not found` when there is no GPS, which also covers a boot probe that heard no NMEA within 10 s of the first power-on (no module fitted), until the next boot. Upstream's `off(hw)` (a hardware GPS switch) does not occur here | | `get gps` | *(ZephCore only)* The detail: `> on state= sats=N fix=Ns ago lat= lon=`, or `no fix next=Ns` (seconds to the next wake); `> off`; `> not found` where `gps` says `Error, gps provider not found` | | `gps diag` | Receiver liveness, in upstream's key form: `> req:<0\|1> en:<0\|1> ok: sat: fix:<0\|1> fa: bc: sc:`. `req` is the requested setting, `en` the module powered and searching (0 in duty-cycle standby), `ok` NMEA sentences the driver has parsed since boot (a count that stops rising means the module or its UART went silent, whatever `sat` says), `fa` the age of the last validated fix, `bc`/`sc` module power-on/off counts. Upstream's UART byte and bad-checksum counters are absent: the GNSS driver only passes valid sentences. Module configuration results are `get gps diag` | | `gps sync` | Take a fresh fix now (wake the GPS or extend its window); the fix sets the clock. `OK`; `Error, gps is off` (upstream instead waits for the next fix) / `Error, gps provider not found` | | `gps fix` | The last fix, upstream's form: `> Fix (N sat): , ` while the fix is live (acquiring, a fix in the last 2 s), `> Fix ago (N sat)[, acq ]: , ` otherwise, `> No fix[, acq ]` before any fix since boot. `acq` is how long the current acquire window has run, shown while acquiring | | `gps once` / `gps once -s` | A fix now. GPS off: powered on for one acquire window (the long cold-start one) and off again after a validated fix or the timeout, `OK - turning on and acquiring`; nothing is saved, and `gps on` during the window keeps it on. In duty-cycle standby: woken now, `OK - waking gps`. Already acquiring: the window is extended as `gps sync`, `OK - gps already on`. `-s` is accepted and changes nothing: every validated fix sets the clock here. `Error, gps provider not found` without a GPS | | `gps period` / `gps period ` | The acquisition period, upstream's name for `set gps duty`: the same setting. `> 0 (continuous)` or `> N` (seconds). A value is digits with an optional `s`, `m`, `h` or `d` (`30m`, `48h`, `2d`); `0` = continuous. Setting it also turns the GPS on (saved), as upstream; clamped like `set gps duty` (10 s to 1 week), so `gps period 5` stores 10. `Error, invalid gps period` / `Error, gps provider not found`. Stored in prefs.json as `gps.int`; upstream's new `gps.period` key is not written, so the prefs.json format is unchanged | | `gps firstfix` / `gps firstfix ` | Limit of a first-fix acquire window, upstream's command (#3823): `> N` (seconds) or `> 0 (no limit)`. A value takes `gps period`'s syntax (`30m`, `1h`); `0` = search until a fix; at most `1d`. `OK`, `Error, invalid first fix timeout`, `Error, gps provider not found`. Saved (`gps.ffix`); unset, the build default (`CONFIG_ZEPHCORE_GPS_FIRST_FIX_TIMEOUT_SEC`, 300 s) applies, where upstream's default is 1 h. A first-fix window under way takes the new value at once, counted from its start. **Where upstream differs:** upstream applies it to periodic windows until the first fix since boot; here it is the window after enable and, on a companion, every window after a full power-off (`set gps standby`), the first window of a repeater included. A `gps once` window stays bounded with `0` (by the build default) | | `gps fix_stats` | Time to first fix, upstream's form: `> ttf:/ ok: miss:`. `ttf` is the time from the start of an acquire window to its first good fix (4+ satellites, rounded to the second, one unit), `-` before any; `ok` / `miss` the current run of windows that got a fix / ended without one. A window that `gps off` cuts short counts as neither. RAM only, since boot | | `gps guard` | *(builds with `CONFIG_ZEPHCORE_GPS_GUARD`, as upstream's `GPS_GUARD`)* Anti-spoofing guard status: `> time