78 Commits

Author SHA1 Message Date
Lloyd
f5dbd83cda feat: add backup and restore and DB man 2026-03-27 11:15:53 +00:00
Lloyd
d82c90a04d fix: MQTT schedule the reconnect timer before calling disconnect(), so by the time _on_broker_disconnected fires, the pending reconnect is already visible. 2026-03-24 12:33:33 +00:00
Lloyd
07c6f14b4b Merge branch 'feat/companion' into dev-companion-v2-cleanup 2026-03-13 09:07:34 +00:00
agessaman
9326868f6e Implement contact import functionality for companions
- Added `companion_import_repeater_contacts` method in `SQLiteHandler` to import repeater adverts into a companion's contact store, with options for filtering by contact types, last seen hours, and import limits.
- Introduced `_get_sqlite_handler` method in `CompanionAPIEndpoints` to ensure the SQLite handler is available for contact import operations.
- Created `import_repeater_contacts` endpoint to handle POST requests for importing contacts, validating input parameters, and returning the count of successfully imported contacts.
- Updated the frontend to reflect changes in the contact import process, ensuring a seamless user experience.
2026-03-12 15:39:04 -07:00
Lloyd
6c3252e51c fix letmesh logging typo 2026-03-10 13:55:35 +00: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
agessaman
1fbd99d52c Add JSON serialization support for companion preferences
- Introduced a new utility function, _to_json_safe, to ensure companion preferences are JSON-serializable, handling various data types including enums and dataclasses.
- Updated the RepeaterCompanionBridge to use the new serialization method when saving preferences to SQLite.
- Modified SQLiteHandler to ensure companion_hash is consistently converted to a string before database operations.
- Enhanced error handling for preference persistence in the RepeaterCompanionBridge.
2026-03-03 16:20:52 -08:00
agessaman
4f94b343cc Modify CompanionBridge integration to support persisting NodePrefs
- Added new methods to SQLiteHandler for loading and saving companion preferences as JSON, improving data persistence.
- Introduced a migration to create a companion_prefs table for storing preferences, ensuring compatibility with existing data.
- Refactored main.py to utilize RepeaterCompanionBridge instead of CompanionBridge, aligning with the new architecture.
2026-03-02 21:28:15 -08:00
Lloyd
4a05e20172 Add CRC error tracking and API endpoints for error count and history
- Create a new table for storing CRC errors in SQLite.
- Implement methods to store and retrieve CRC error counts and history.
- Update StorageCollector to record CRC errors and expose relevant methods.
- Enhance RepeaterHandler to track and record CRC error deltas from the radio hardware.
- Add API endpoints to fetch CRC error count and history.
2026-03-02 12:36:08 +00:00
agessaman
d82ebc59b0 Normalize companion_hash format in SQLite migrations to include 0x prefix
- Updated the SQLiteHandler to apply a migration that prefixes companion_hash values with '0x' for consistency with room_hash patterns.
- Adjusted the main.py file to reflect the new formatting for companion_hash when generating its string representation.
2026-02-28 09:06:24 -08:00
agessaman
6fa85a832f Update packet type labels in rrdtool_handler and sqlite_handler for consistency
- Enhanced readability by adding descriptive suffixes to packet type labels in both rrdtool_handler.py and sqlite_handler.py.
- Aligned packet type definitions with the new naming conventions from pyMC_core, ensuring consistency across the codebase.
2026-02-27 21:18:29 -08:00
agessaman
789a2f27ea Enhance PacketRouter and CompanionFrameServer for improved packet delivery and contact persistence
- Updated PacketRouter to deliver packets to all companion bridges when the destination is not recognized, ensuring better handling of ephemeral destinations.
- Refactored CompanionFrameServer to separate contact serialization and persistence logic, allowing for non-blocking database operations.
- Introduced a unique index for companion contacts in SQLite to support upsert functionality, enhancing data integrity and performance.
- Improved AdvertHelper to run database operations in a separate thread, preventing event loop blocking and maintaining responsiveness.
2026-02-24 21:51:56 -08: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
d5cabe831c Fix message persistence and deduplication in CompanionFrameServer
- Updated `_persist_companion_message` to clarify deduplication of messages in SQLite.
- Modified `on_message_received` and `on_channel_message_received` to include `packet_hash` for message identification.
- Enhanced `SQLiteHandler` to support deduplication by `packet_hash` when pushing messages, preventing duplicates in the database.
- Added `packet_hash` column to the `companion_messages` table and created an index for efficient lookups.
2026-02-14 20:53:25 -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
Lloyd
bc23001cd6 Enhance MQTT error handling with extended v5 error codes and improved logging 2026-02-11 09:34:56 +00: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
theshaun
57a25a2dc0 Add support for Femtofox
- Introduce GPIO chip selection and GPIO backend selection
- Add default Femtofox settings (for SX1262 as LR1121 support may come later)
- Add support for Python 3.10 UTC to reduce footprint
- Fix airtime calculation bandwidth variable naming
- Add service auto-enable when starting
- Add Australia: SA, WA, QLD radio preset
- Add Snyk security instructions

Co-authored-by: theshaun <theshaun@users.noreply.github.com>
Based on PR #69
2026-02-03 22:34:14 +00:00
Lloyd
f7c4e2b4a8 Add support for new radio hardware configurations and CH341 USB adapter 2026-02-03 22:28:53 +00:00
Lloyd
b0e19b13af Add bulk packet retrieval API with gzip compression and pagination support. 2026-02-03 10:21:59 +00:00
Lloyd
0d14884adb broker connection management with JWT reconnection scheduling and error handling 2026-01-23 14:47:29 +00:00
Lloyd
5e4adf62b3 add ed auth to WS 2026-01-20 21:53:24 +00:00
Lloyd
8b95bfb8ba feat: enhance MQTT error handling and add packet stats broadcasting 2026-01-20 20:31:45 +00:00
Lloyd
33e353d215 fix: update reconnection logic to refresh JWT token before connecting 2026-01-19 12:41:54 +00:00
Lloyd
599e4628d9 Changes include:
Features

Neighbour details modal with full info and map view

WebSocket support with heartbeat and automatic reconnection

Improved signal quality calculations (SNR-based RSSI)

Route-based pagination for faster initial loads

UI

Mobile sidebar tweaks (logout, version info, lazy-loaded charts)

Sorting added to the neighbour table

Packet view now shows multi-hop paths

CAD calibration charts respect light/dark themes

Statistics charts now show the full requested time range

Performance

Reduced polling when WebSocket is active

Lazy loading for heavier components

Noise floor data capped to keep charts responsive

Technical

Improved type safety across API responses

Contrast improvements for accessibility

Cleaner WebSocket and MQTT reconnection handling

Additional metrics added to heartbeat stats

Bug fixes

Corrected noise floor history query

Fixed authentication for CAD calibration streams

Nothing major required from users — just update and carry on.
As always, shout if something looks off.
2026-01-18 20:15:50 +00:00
Lloyd
4f22cb1308 Convert public key to uppercase when retrieving from local identity 2026-01-09 17:24:10 +00:00
Lloyd
1a527c761f feat: Refactor LetsMesh handler to use LocalIdentity for key management 2026-01-08 09:11:45 +00:00
Lloyd
1b45060e13 Update key retrieval method in StorageCollector to support both standard and firmware keys 2026-01-08 08:52:02 +00:00
Lloyd
32ce1ff698 Add configurable JWT token expiry and WebSocket transport support for MQTT 2026-01-05 16:50:15 +00:00
Lloyd
dfe4adad1c feat: Enhance MQTT configuration with TLS/SSL support and update logging 2026-01-05 10:47:14 +00:00
Paul Picazo
9288e070aa fix: Add missing Dict, Any import to sqlite_handler.py 2026-01-03 14:47:37 -08:00
Paul Picazo
942d4dfe28 Enhance advert storage logic: prioritize direct routes and handle zero-hop measurements
Refactor packet processing: use processed_packet for forwarding and drop reason checks

Fix: Update zero-hop determination logic in AdvertHelper

Fix: Clone packet in process_packet to prevent modification of the original

Fix: Import copy module for deep copying of packets in process_packet
2026-01-03 14:35:30 -08:00
Lloyd
7112da98c2 feat: Add authentication endpoints and JWT support
- Implemented JWT authentication with auto-generated secret if not provided.
- Added API token management functionality.
- Created authentication endpoints for login, token refresh, verification, and password change.
- Introduced API documentation endpoints for Swagger UI and OpenAPI spec.
- Enhanced CORS support for API and documentation endpoints.
- Updated OpenAPI specification to include new authentication and system endpoints.
2025-12-30 00:10:48 +00:00
Lloyd
32e13cb40e Enhance LetsMesh broker configuration and connection management
- Added detailed comments and examples for broker selection in config.yaml
- Refactored letsmesh_handler.py to support multiple broker connections
- Implemented connection lifecycle management for individual brokers
- Improved JWT token handling and publishing across all connected brokers
2025-12-22 13:08:30 +00:00
Lloyd
038b4ac58d Handle None values for TX packets in RRD metrics by using 'U' for unknown values 2025-12-21 21:01:58 +00:00
Lloyd
9a56c03ae7 Add LBT metrics to packet storage and logging in RepeaterHandler 2025-12-21 20:41:22 +00:00
Lloyd
f5daf41825 MeshCLI and RoomServer initialization with identity and storage handler support; update neighbor listing to filter repeaters and zero hop nodes. 2025-12-20 22:03:02 +00:00
Lloyd
4e1eb888e5 Refactor database connection handling in StorageCollector and reduce log verbosity in RoomServer to minimize spam during idle periods 2025-12-18 22:12:25 +00:00
Lloyd
d321612670 Add node name lookup by public key and enhance CORS handling in API endpoints 2025-12-18 21:26:31 +00:00
Lloyd
9cd98cd7ad Add room server messaging endpoints and database functions
- Implemented functions to retrieve, post, delete, and clear messages in room servers.
- Added API endpoints for room message retrieval, posting, and management.
- added OpenAPI documentation to include new room server functionalities.
2025-12-18 11:21:38 +00:00
Lloyd
710ee5b666 Implement room server functionality: add database schema, message handling, and client synchronization 2025-12-18 10:44:00 +00:00
Lloyd
b956f69e76 remove lgpio from installation script improve logging output for generated tokens 2025-12-09 09:20:19 +00:00
Lloyd
3de7dfefa6 Neighbors ui update add filters 2025-12-08 22:30:00 +00:00
Lloyd
9b53c5b6de Update packet handling to skip invalid advert packets and update record_packet method to conditionally publish to LetsMesh 2025-12-02 16:09:43 +00:00
Lloyd
58011b4993 Remove debug log for adverts retrieval in SQLiteHandler 2025-12-01 15:44:39 +00:00
Lloyd
52e4f6bef5 add hardware statistics collection to StorageCollector and API endpoints 2025-11-29 23:03:15 +00:00
Lloyd
748ecf33b3 hardware statistics integrate with storage collector 2025-11-29 22:42:15 +00:00
Lloyd
330d97d862 add hardware statistics collection and new API endpoints for hardware stats 2025-11-29 22:13:53 +00:00
Lloyd
d4a18a9808 feat: add email and owner fields to node info and JWT payload for TLS connections 2025-11-25 17:24:15 +00:00