73 Commits

Author SHA1 Message Date
agessaman 183650228e feat(config): add optional KISS CSMA tuning parameters
- Updated `config.yaml.example` to include optional KISS key-up and CSMA tuning parameters.
- Enhanced `get_radio_for_board` function in `config.py` to forward KISS tuning settings to the modem firmware when specified.
- Added tests to verify correct forwarding of KISS parameters and omission of unset values in `test_radio_config.py`.
2026-06-08 21:25:26 -07:00
Lloyd e9a9f21cab feat: update preamble_length to 32 for radio configurations 2026-06-05 16:00:23 +01:00
Rightup 14b4804c26 feat: Enhance logging system and introduce policy management endpoints
- Updated LogBuffer to support log entry IDs, enhanced log entry structure with additional metadata, and implemented subscriber management for real-time log streaming.
- Added OpenAPI specifications for new endpoints related to policy management, including retrieval, updating, validation, and group management for network policies.
- Implemented comprehensive tests for new policy endpoints, ensuring correct behavior for creating, updating, validating, and deleting policy groups and entries.
- Introduced policy evaluation tests to validate the functionality of the PolicyEngine, including various scenarios for action decisions based on defined rules.
- Enhanced packet routing tests to ensure proper handling of policy decisions in packet processing.
2026-06-04 15:53:17 +01:00
Lloyd b464fa8593 docs: update example configuration for Waveshare UPS D and E Hats 2026-05-21 12:42:22 +01:00
Lloyd 22adbd1a84 feat: add setup usb/tcp details on setup 2026-05-19 14:45:26 +01:00
Lloyd 7d54859348 Add example configurations for SHTC3 and Waveshare UPS Hat sensors 2026-05-19 11:17:12 +01:00
Lloyd e0dbecd51c feat: update default radio type to null in config example 2026-05-18 15:59:49 +01:00
Lloyd 13b8004ad5 wip: null-radio defaults and needs_setup updates 2026-05-18 13:00:00 +01:00
Lloyd 5b95be3db5 refactor: remove sync word configuration from radio settings 2026-05-14 17:20:13 +01:00
itk80 541b25b47c config: add pymc_tcp / pymc_usb radio_type branches
Wires the TCPLoRaRadio and USBLoRaRadio drivers that landed in pyMC_core
on 2026-05-13 (PR pyMC-dev/pyMC_core#68) into get_radio_for_board() so
they can be selected from a repeater config file without any code change
in main.py / api_endpoints.

Both branches follow the existing pattern: read host/port (TCP) or
serial port (USB) plus auth/LBT options from their own config section,
share the LoRa parameters from the common `radio` section, fall back to
the firmware-default sync word 0x12, and surface ImportError as a clear
RuntimeError if the installed pymc_core is too old to ship the drivers.

config.yaml.example documents both sections and updates the radio_type
header comment with the full supported list. Five new tests in
tests/test_radio_config.py monkeypatch the radio classes and verify the
section/parameter wiring + missing-required-field errors.

No web UI / endpoint changes — the deployment this targets edits the
config file directly. A GUI wizard for these radio types can land
separately if there's appetite.
2026-05-13 17:30:09 +02:00
Lloyd 0e7bb05208 Refactor INA219 sensor integration. 2026-05-13 12:34:05 +01:00
Joshua Mesilane 3f7b6d5cdc fix: add smbus2 dependency, i2c-tools, and use hex I2C addresses in docs
- Add smbus2>=0.4.0 to pyproject.toml core dependencies so it is always
  present in the venv rather than relying on runtime auto-install
- Add i2c-tools to apt-get installs in both install and upgrade paths
  so /dev/i2c-* devices are accessible and i2cdetect is available for
  diagnostics (service user was already being added to the i2c group)
- Switch ENS210 config examples to hex I2C address notation (0x43) to
  match datasheets and i2cdetect output; update contributor docs guidance
  accordingly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13 11:54:32 +10:00
Joshua Mesilane 9bfe1259da feat: add ENS210 temperature/humidity sensor plug-in
Adds support for the ENS210 relative humidity and temperature sensor
as a new plug-in under repeater/sensors/ens210.py. Also adds a
commented configuration example to config.yaml.example and a
contributor guide at docs/adding_sensors.md explaining how to add
further sensor plug-ins.

## Implementation notes

### Why smbus2 instead of an Adafruit/CircuitPython library

The ENS210 has no maintained Adafruit CircuitPython driver. The
available third-party options are either unmaintained or bring in the
full Blinka/CircuitPython hardware-abstraction stack as a dependency.
smbus2 is a thin, widely-packaged wrapper around the Linux i2c-dev
kernel interface that is already present on Raspberry Pi OS and most
Debian-based systems. It has no transitive dependencies and adds no
abstraction cost.

The ENS210 protocol is simple enough that direct register access is
preferable: two writes to start a measurement (REG_SENS_RUN + REG_SENS_START)
and two three-byte block reads to retrieve temperature and humidity.
The status/validity bit is checked inline rather than relying on a
library to surface it. There is no value a higher-level driver would
add here.

### Read strategy

A fixed post-trigger delay is unreliable — the sensor datasheet quotes
~130 ms typical conversion time but the actual ready time varies. The
implementation instead polls the data-valid status bit (bit 1 of the
third byte in each register block) every 50 ms for up to
read_timeout_seconds (default 1.0 s), breaking as soon as both T and
H report valid data. This is the same approach used in the validated
reference script.

The I2C bus is opened and closed on every read rather than kept open
across poll cycles. Keeping a persistent SMBus handle caused subsequent
reads to time out, consistent with the Linux i2c-dev file descriptor
accumulating state between transactions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13 11:46:26 +10:00
Lloyd 66532a0647 feat: Add sensor plugin framework and Sensors 2026-05-12 14:18:33 +01:00
Daniel Duran dfacfeade8 feat: bundled MC2MQTT broker presets (waev, letsmesh) + format family
Introduces a 'set format and forget' workflow for MQTT brokers. Users
reference a bundled preset by name inside the existing brokers: list,
and the package supplies the endpoints, audiences, and TLS settings.
Endpoint changes ship via 'pip install -U' instead of manual edits.

What changes
- New repeater/presets/ package with a tiny lazy YAML loader and two
  bundled presets: waev (mqtt-{a,b}.waev.app) and letsmesh (EU + US).
- New format-family constant MC2MQTT_FORMATS = ('meshcoretomqtt',
  'letsmesh', 'waev') replaces the inline tuple in topic resolution.
  The legacy 'mqtt' format keeps its custom-topic semantics unchanged.
- Two-pass broker assembly in mqtt_handler.py: pass 1 expands every
  {preset: <name>} entry inline; pass 2 collapses duplicates by name
  with later-wins semantics. Place override entries AFTER preset
  entries.
- Hard-coded LETSMESH_BROKERS constant deleted; its data now lives in
  repeater/presets/letsmesh.yaml.
- convert_letsmesh_to_broker_config() collapsed from ~70 to ~25 lines
  by emitting {preset: letsmesh} plus disable overrides for unwanted
  brokers. Honors broker_index in (-1, 0, 1), additional_brokers, and
  enabled flag exactly as before.
- update_mqtt_config API endpoint accepts {preset: <name>} entries and
  passes them through unchanged so the web UI can author them when the
  frontend is updated.
- config.yaml.example documents the preset entry shape, the override
  rule, and the format family hierarchy.
- pyproject.toml ships presets/*.yaml as package data.

How to use
  mqtt_brokers:
    iata_code: "LAX"
    brokers:
      - preset: waev

  # Override a single preset broker:
  brokers:
    - preset: waev
    - name: waev-b
      enabled: false

Tests
- tests/test_presets.py: 9 tests covering loader, expand/merge,
  MC2MQTT topic-family parity, and parametrized legacy migration.

Co-Authored-By: Oz <oz-agent@warp.dev>
2026-05-02 15:32:22 -07:00
Rightup 9d3d5e6ef0 refactor: update GPS configuration parameters and improve documentation 2026-04-30 20:28:50 +01:00
Mitchell Moss d83cb61fe7 Make GPS location persistence opt-in and fuzzed 2026-04-29 10:45:53 -04:00
Mitchell Moss bf44efbfd9 feat: update repeater location from GPS fix 2026-04-29 09:36:05 -04:00
Rightup 76a9785218 Add GPS location configuration and diagnostics stream
- Introduced options for using GPS coordinates for repeater location fields in config.
- Implemented precision control for GPS coordinates.
- Added a new API endpoint for a Server-Sent Events stream of GPS diagnostics.
- Updated GPSService to handle new configuration options and fallback logic.
- Enhanced unit tests for GPS location handling.
2026-04-28 23:22:52 +01:00
Lloyd 42b4bbd9e9 Merge PR #199: [codex] Add GPS diagnostics API 2026-04-28 17:24:34 +01:00
Rightup d780afa56a Add support for RAK6421 with RAK13300x radios and enhance configuration options
- Introduced `en_pin` and `en_pins` parameters in radio configuration.
- Updated `get_radio_for_board` to handle new configuration options.
- Added unit tests to verify correct handling of `en_pins`.
2026-04-26 15:52:27 +01:00
Rigear bdb98f3f49 fix(docs): Updated example config with TLS information 2026-04-24 16:48:51 -07:00
Mitchell Moss 8ae1c0f65f feat: sync system time from GPS 2026-04-24 08:34:30 -04:00
Mitchell Moss 9cd2de94e8 chore: move GPS diagnostics UI to frontend repo 2026-04-24 07:41:13 -04:00
Mitchell Moss 18300cbf42 feat: add GPS diagnostics web UI 2026-04-23 18:54:19 -04:00
Lloyd 1626b3f307 feat: add max flood hops configuration to repeater settings 2026-04-22 13:52:40 +01:00
Rigear 2e1d19ab80 Merge remote-tracking branch 'origin/dev' into feat/mqtt_merge
# Conflicts:
#	config.yaml.example
#	repeater/data_acquisition/__init__.py
#	repeater/data_acquisition/storage_collector.py
#	repeater/web/html/assets/CADCalibration-319vQEzv.js
#	repeater/web/html/assets/CADCalibration-Cwr0Kq49.js
#	repeater/web/html/assets/CADCalibration-DWusgblB.js
#	repeater/web/html/assets/Companions-DU19yZyB.js
#	repeater/web/html/assets/Companions-cufpceKN.js
#	repeater/web/html/assets/Companions-zmTexa6a.js
#	repeater/web/html/assets/Configuration-BmDpq7bV.js
#	repeater/web/html/assets/ConfirmDialog-BafURQpE.js
#	repeater/web/html/assets/ConfirmDialog-C9Yf394V.js
#	repeater/web/html/assets/ConfirmDialog-h2bJ_WKJ.js
#	repeater/web/html/assets/Dashboard-CnQfG826.js
#	repeater/web/html/assets/Login-BDsVY-me.js
#	repeater/web/html/assets/Logs-BpG7T8_d.js
#	repeater/web/html/assets/Logs-CVZ1ZqH8.js
#	repeater/web/html/assets/Logs-sxcWuUjs.js
#	repeater/web/html/assets/MessageDialog-B-qWtO0z.js
#	repeater/web/html/assets/MessageDialog-Cp4W1enq.js
#	repeater/web/html/assets/MessageDialog-D2OlpbZ7.js
#	repeater/web/html/assets/Neighbors-BAwKrJdF.js
#	repeater/web/html/assets/Neighbors-BamkiPcU.js
#	repeater/web/html/assets/Neighbors-WHAK_7hU.js
#	repeater/web/html/assets/RoomServers-DbCgmJ6x.js
#	repeater/web/html/assets/RoomServers-i32N0iwv.js
#	repeater/web/html/assets/RoomServers-o3kDed-S.js
#	repeater/web/html/assets/Sessions-B8ZVRIGt.js
#	repeater/web/html/assets/Sessions-B9uqWGaO.js
#	repeater/web/html/assets/Sessions-O3vBapMM.js
#	repeater/web/html/assets/Setup-DyJMgh0L.js
#	repeater/web/html/assets/Statistics-BbiQtXdu.js
#	repeater/web/html/assets/Statistics-CeTg6NYy.js
#	repeater/web/html/assets/Statistics-QSH8GjMX.js
#	repeater/web/html/assets/SystemStats-B7qxcRYp.js
#	repeater/web/html/assets/SystemStats-BmXJQonl.js
#	repeater/web/html/assets/SystemStats-DVaA1ybj.js
#	repeater/web/html/assets/Terminal-CUqcF84y.js
#	repeater/web/html/assets/Terminal-D1kRkrmc.js
#	repeater/web/html/assets/Terminal-Dq6FyjMj.js
#	repeater/web/html/assets/api-CiSov_eM.js
#	repeater/web/html/assets/api-DegLD39Y.js
#	repeater/web/html/assets/api-DjLVJkR1.js
#	repeater/web/html/assets/index-cutq4vvY.js
#	repeater/web/html/assets/packets-Bg0pkGLO.js
#	repeater/web/html/assets/packets-CPLd89q8.js
#	repeater/web/html/assets/packets-DmoWuBlc.js
#	repeater/web/html/assets/system-Bocs8bSU.js
#	repeater/web/html/assets/system-CsY7_jKa.js
#	repeater/web/html/assets/system-qCwV23PE.js
#	repeater/web/html/assets/useSignalQuality-DQTATYAm.js
#	repeater/web/html/assets/useSignalQuality-DlXA7j0p.js
#	repeater/web/html/assets/useSignalQuality-u0_rDpC6.js
#	repeater/web/html/index.html
2026-04-18 20:25:30 -07:00
Rightup ffaaa76ea0 feat: add glass to repeater. 2026-04-17 23:51:04 +01:00
Rigear 06573d2373 Merge remote-tracking branch 'origin/dev' into feat/mqtt_merge 2026-04-15 21:22:10 -07:00
Rigear 01aed0db2b docs: Added retain_status message to example config 2026-04-15 21:22:02 -07:00
Lloyd 4d49eb701b feat: add owner_info field to repeater configuration and add getter for protocol request handling 2026-04-13 16:49:02 +01:00
Rigear 3b7de6061b docs: Updated example config 2026-04-11 22:26:40 -07:00
Joshua Mesilane 2c95c0db0a Update example config files 2026-04-09 08:59:52 +10:00
Lloyd 031f7b5e47 feat: add identity_key support in repeater configuration and update related logic in config handling 2026-03-27 10:16:10 +00:00
agessaman 7558c5604c feat: enhance repeater TX mode functionality so companion tenants can TX while in monitor mode
- Modify TX modes: forward, monitor, and add no_tx, allowing for flexible packet handling.
- Updated configuration and API endpoints to support the new modes.
- Adjusted logic in RepeaterHandler to manage packet processing based on the selected mode.
- Enhanced CLI commands to reflect the new mode settings.
- Added tests for each TX mode to ensure correct behavior.
2026-03-15 13:03:18 -07:00
agessaman 062dabc46e Enhance TCP timeout configuration for companions
- Added `tcp_timeout` setting to `config.yaml.example` for companion configurations, allowing customization of TCP connection timeouts.
- Updated `RepeaterDaemon` to retrieve and apply the `tcp_timeout` setting, with a default value of 120 seconds.
- Modified `CompanionFrameServer` to accept `client_idle_timeout_sec` parameter, ensuring proper handling of idle timeouts.
- Enhanced API endpoints to include `tcp_timeout` in companion settings, improving configuration visibility and management.
2026-03-07 20:39:37 -08:00
agessaman 3725d6eb21 Add path hash mode configuration and management
- Introduced `path_hash_mode` setting in `config.yaml.example` to specify the hash size for flood packets.
- Updated `ConfigManager` to re-apply the path hash mode when the mesh section changes, with validation for acceptable values (0, 1, 2).
- Enhanced `RepeaterDaemon` to set the default path hash mode during initialization, ensuring consistent handling of flood packets.
2026-03-07 13:57:46 -08:00
agessaman c150b9a9bf Merge upstream/feat/newRadios into dev-companion-v2-cleanup
- Keep our Vite-built assets and index.html script (index-DyUIpN7m.js)
- Remove upstream-only asset chunks and RoomServers-BxQ-0q-x.js
- README: keep two-backend intro, add upstream CAUTION/compatibility table
- manage.sh: keep dialog/gauge UX and .[hardware]; add CH341 udev, sudoers, libusb, polkit, silent upgrade
- sqlite_handler: add crc_errors table, index, and cleanup from upstream
- engine: add validate_packet and mark_seen in direct_forward; keep our path hash_size/hop_count logic
- advert: keep comment, use current_time = now
- api_endpoints: use restart_service() from service_utils
- config merge: strip user config comments before yq merge (upstream)

Made-with: Cursor
2026-03-05 16:43:14 -08:00
Lloyd 136af19178 add loop detection configuration and tests for flood routing 2026-03-05 14:06:28 +00:00
Lloyd 998955ec52 Update minimum advertisement interval to 0 for improved mesh retransmission handling 2026-03-05 10:46:24 +00:00
Lloyd 6a52268b8c Disabl as default advertisement rate limiting and adaptive scaling features in configuration 2026-03-05 10:39:35 +00:00
Lloyd 4285023670 Implement adaptive advert rate limiting and configuration updates 2026-03-05 10:35:15 +00:00
Lloyd c2f57c3d0f add tests and more validation to packets, remove crc setting from config as hardcoded. 2026-03-02 11:35:50 +00:00
agessaman e9841adeff Merge upstream feat/newRadios (radios, MQTT, SPI)
- Take upstream radio-presets.json and radio-settings.json (Femtofox, AIO v2, CH341).
- config.py: upstream get_radio_for_board (_parse_int, sx1262_ch341, GPIO) + re-add KISS branch.
- config.yaml.example: upstream radio/ch341 + our identities.companions.
- manage.sh: upstream SPI warning prompt.
- main.py: single try/finally with companion shutdown and _shutdown().
- letsmesh_handler: upstream UTC fallback and MQTT v5 reason code handling.
- storage_collector, api_endpoints: upstream storage_dir_cfg; apply_setup_wizard supports KISS and sx1262_ch341/ch341.
- airtime.py: upstream bw_hz fix for symbol time.
- pyproject.toml: keep pymc_core dependency (no git pin).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-21 15:59:01 -08:00
agessaman c2f8a2e3cd refactor: companion FrameServer and related (substantive only, no Black)
Reapply refactor from ce8381a (replace monolithic FrameServer with thin
pymc_core subclass, re-export constants, SQLite persistence hooks) while
preserving pre-refactor whitespace where patch applied cleanly. Remaining
files match refactor commit exactly. Diff vs ce8381a is whitespace-only.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-21 15:35:47 -08:00
agessaman 15299bf374 Add companion module and API integration
- Add repeater/companion with frame server and constants
- Extend config, sqlite_handler, mesh_cli, packet_router for companion
- Update api_endpoints and auth_endpoints; adjust main entry

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 16:07:43 -08:00
agessaman 878ff8dc51 Enhance configuration and setup for KISS modem support
- Added support for Meshcore KISS modem firmware in configuration, allowing users to set `radio_type: kiss` and configure serial port and baud rate.
- Updated `config.yaml.example` to include KISS modem settings.
- Modified `manage.sh` to install with hardware extras for KISS support.
- Enhanced `setup-radio-config.sh` to prompt for radio type and KISS modem settings.
- Updated API endpoints to handle KISS modem configurations and hardware options.
- Improved error handling for missing configuration sections.

This update improves flexibility for users utilizing KISS modems alongside SX1262 hardware.
2026-02-03 16:20:51 -08:00
Lloyd f7c4e2b4a8 Add support for new radio hardware configurations and CH341 USB adapter 2026-02-03 22:28:53 +00:00
Lloyd 1999af8bdd add Packet Hash Cache to UI 2026-01-10 22:59:43 +00:00
Lloyd 32ce1ff698 Add configurable JWT token expiry and WebSocket transport support for MQTT 2026-01-05 16:50:15 +00:00