> ## Documentation Index
> Fetch the complete documentation index at: https://docs.altnautica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# LoRa beacon lane

> A low-duty LoRa lane for position beacons: enable it, pick the region, read the band plan the governor enforces, and list the beacons heard.

`ados-lora` runs a low-duty LoRa lane next to the main radio link. It carries position beacons, short status reports and text, never video, corrections or a control loop. Each node beacons its position every `lora.beacon_interval_s` seconds (30 by default) and lists the beacons it hears from other nodes.

The service runs on the `drone` and `ground_station` profiles, and only when `lora.enabled` is `true`.

Every transmission passes a per-region governor first. The governor decides, frame by frame, whether a transmission is legal right now, on which channel and at what power, under the region's duty cycle, dwell time, listen-before-talk and power limits. It charges each frame's airtime to a ledger on disk (`/var/ados/lora/airtime.jsonl`) before sending, so a reboot cannot reset the duty budget.

## Radios

`lora.transport` picks the radio:

| Transport | Hardware |
| - | - |
| `e22` (default) | An Ebyte E22 UART module on `lora.e22.port`. Set `lora.e22.module_band` to the fitted module: `850-930` (E22-900) or `410-493` (E22-400). `m0_gpio` and `m1_gpio` name the mode lines; leave them unset when the lines are strapped. |
| `meshtastic` | A Meshtastic node bridged over its serial port. |
| `loopback` | A UDP stand-in radio for simulation. |

## Enable the lane

**1. Set the region**

Transmit needs a region. The lane uses `lora.region` when it is set, otherwise the node's country setting `network.regulatory.region`. With neither, transmit is blocked and receive stays on.

**2. Turn it on**

Set `lora.enabled: true` in `/etc/ados/config.yaml`. The installer mirrors it into the `/etc/ados/lora-enabled` marker the unit starts on.

**3. Check the lane**

`GET /api/v1/lora` shows `tx_allowed` and, when transmit is blocked, `blocked_reason`.

## Read the lane

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -s -H "X-ADOS-Key: $ADOS_KEY" http://192.168.1.50:8080/api/v1/lora
```

| Field | Meaning |
| - | - |
| `present` | `true` while the lane reports. When it does not, every other field holds its empty value; the route never answers 404. |
| `transport`, `module_band`, `node_id` | The radio in use. |
| `region` | The resolved plan: `code`, `name`, `plan_id`, `source` (`lora.region` or `network.regulatory.region`), `band_mhz`, `citation`, `tx`, `meshtastic_preset`. `null` with no region. |
| `channel` | The channel in use. |
| `tx_allowed`, `blocked_reason` | Whether the governor allows transmit now, and why not. |
| `governor` | The active `rules`, `next_tx_allowed_ms` and the `last_refusal`. |
| `tx` | `frames`, `refused`, and `refused_by_rule` counted per rule: `duty_cycle`, `dwell_time`, `lbt`, `max_power`, `region_unset`, `module_band_mismatch`. |
| `rx` | `frames` and `crc_errors`. |
| `meshtastic` | The bridge's `enabled`, `connected`, `port` and `region_preset`. |

### Region table

`GET /api/v1/lora/regions` returns the compiled band-plan table. Each row has `code`, `name`, `plan_id`, `band_mhz`, the `rules` it enforces, `citation` (the regulator document its numbers come from), `meshtastic_preset`, `elrs_domains`, and `supported_by_module`: whether the fitted module can run that plan, or `null` when no module is known.

### Beacons heard

`GET /api/v1/lora/beacons` returns up to 100 beacons, newest first:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"beacons": [{"node_id": 7, "kind": "beacon", "lat_deg": 47.3977, "lon_deg": 8.5456,
  "alt_m": 488, "battery_pct": 82, "mode": "LOITER", "rssi_dbm": -97, "snr_db": 6.5,
  "received_at_ms": 1793960003000}]}
```

A beacon reports the vehicle's position from the MAVLink state when it has one, otherwise the node's own GNSS receiver. Fields the sender does not know are `null`.

## Change region, channel or power

`PUT /api/v1/lora` takes any of `region` (a code, or `null` to follow the country setting), `freq_mhz`, `erp_mw` and `sf`.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -s -X PUT -H "X-ADOS-Key: $ADOS_KEY" -H "Content-Type: application/json" \
  -d '{"region": "EU", "sf": 10}' http://192.168.1.50:8080/api/v1/lora
```

Every value is checked against the plan it would run under before anything is saved. A value outside the plan is a `400` with `E_LORA_OUT_OF_PLAN` and the reason. An accepted change is written to the `lora` block, the lane reloads, and the reply is the `GET /api/v1/lora` body once the lane reports the new values. If it has not reported within a few seconds the reply is `504`: the change is saved, but not yet confirmed.

A body that names `region` is refused while the vehicle is armed. Through an MCP token, any write to this route needs admin scope.

## Configuration reference

| Key | Type | Default | Allowed | Description |
| - | - | - | - | - |
| `lora.air_rate` | string | `"2.4k"` | n/a | Air Rate |
| `lora.antenna_gain_dbi` | number | `2.15` | -10 to 20 | Antenna Gain Dbi |
| `lora.beacon_interval_s` | integer | `30` | 1 to 3600 | Beacon Interval S |
| `lora.bw_khz` | integer | `125` | 7 to 500 | Bw Khz |
| `lora.cable_loss_db` | number | `0` | 0 to 30 | Cable Loss Db |
| `lora.cr` | integer | `1` | 1 to 4 | Cr |
| `lora.e22.baud` | integer | `9600` | 1200 to 115200 | Baud |
| `lora.e22.gpio_chip` | string | `"gpiochip0"` | n/a | Gpio Chip |
| `lora.e22.m0_gpio` | integer\|null | n/a | 0 to 1023 | M0 Gpio |
| `lora.e22.m1_gpio` | integer\|null | n/a | 0 to 1023 | M1 Gpio |
| `lora.e22.module_band` | string | `"850-930"` | `"850-930"`, `"410-493"` | Module Band |
| `lora.e22.port` | string | `"/dev/ttyUSB0"` | n/a | Port |
| `lora.enabled` | boolean | `false` | n/a | Enabled |
| `lora.erp_mw` | number\|null | n/a | 0 to 4000 | Erp Mw |
| `lora.freq_mhz` | number\|null | n/a | 0 to 6000 | Freq Mhz |
| `lora.ledger_path` | string | `"/var/ados/lora/airtime.jsonl"` | n/a | Ledger Path |
| `lora.loopback.bind` | string | `"0.0.0.0:7810"` | n/a | Bind |
| `lora.loopback.module_band` | string | `"any"` | `"any"`, `"850-930"`, `"410-493"`, `"863-928"` | Module Band |
| `lora.loopback.peer` | string | `"127.0.0.1:7811"` | n/a | Peer |
| `lora.meshtastic.enabled` | boolean | `false` | n/a | Enabled |
| `lora.meshtastic.port` | string\|null | n/a | n/a | Port |
| `lora.node_id` | integer | `1` | 0 to 65535 | Node Id |
| `lora.preamble` | integer | `8` | 6 to 65535 | Preamble |
| `lora.region` | string\|null | n/a | n/a | Region |
| `lora.sf` | integer | `9` | 7 to 12 | Sf |
| `lora.transport` | string | `"e22"` | `"e22"`, `"meshtastic"`, `"loopback"` | Transport |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.