This branch is 4 commits behind iarv/Akita-Meshtastic-Meshcore-Bridge:main
sh4un f64b3ae9ec Add comprehensive tests for meshcore-related functionality
- Introduced `test_meshcore.py` with extensive unit tests for:
  - RawSerialProtocol and MeshcoreCompanionProtocol
  - MessageValidator
  - MeshcoreHandler and MeshcoreAsyncHandler
- Enhanced `conftest.py` to include new configuration option `SERIAL_AUTO_SWITCH`.
- Verified encoding and decoding processes for various message types.
- Ensured proper handling of edge cases and error conditions.
2026-02-07 14:24:45 -05:00
2025-04-26 19:02:45 -04:00
2025-11-18 18:57:00 -05:00
2025-05-07 14:22:29 -04:00
2026-02-04 11:17:53 -05:00

Akita Meshtastic Meshcore Bridge (AMMB)

AMMB is a flexible and robust software bridge designed by Akita Engineering to facilitate seamless, bidirectional communication between Meshtastic LoRa mesh networks and external systems via Serial or MQTT.

This bridge enables interoperability, allowing messages, sensor data (with appropriate translation), and potentially other information to flow between Meshtastic and devices connected via Serial (like MeshCore) or platforms integrated with MQTT.


Features

Core Functionality

  • Bidirectional Message Forwarding: Relays messages originating from Meshtastic nodes to the configured external system (Serial or MQTT), and vice-versa.
  • Multiple External Transports: Supports connecting to the external system via:
    • Direct Serial: Interfaces directly with devices (like MeshCore) via standard RS-232/USB serial ports.
    • MQTT: Connects to an MQTT broker to exchange messages with IoT platforms or other MQTT clients.
  • Configurable Serial Protocol: Supports different serial communication protocols via config.ini. Includes a raw_serial handler specifically for MeshCore Companion Mode (Binary).
  • Robust Connection Management: Automatically attempts to reconnect if connections are lost.

Enhanced Features

  • REST API: Built-in HTTP API for monitoring bridge status, metrics, and health (optional, configurable)
  • Health Monitoring: Real-time health status tracking for all bridge components
  • Metrics Collection: Comprehensive statistics on messages, connections, and performance
  • Message Validation: Automatic validation and sanitization of all messages
  • Rate Limiting: Configurable rate limiting to prevent message flooding
  • MQTT TLS/SSL Support: Secure MQTT connections with TLS/SSL encryption
  • Comprehensive Logging: Detailed logging with configurable log levels
  • Message Persistence: Optional message logging to file for analysis and debugging

Installation & Usage

Clone the Repository

git clone https://github.com/AkitaEngineering/akita-meshtastic-meshcore-bridge.git
cd akita-meshtastic-meshcore-bridge

Set up Environment

python -m venv venv
source venv/bin/activate  # or .\venv\Scripts\activate on Windows
pip install -r requirements.txt

Configure

Copy examples/config.ini.example to config.ini and edit it.

  • For MeshCore (Companion USB):
    Set EXTERNAL_TRANSPORT = serial and SERIAL_PROTOCOL = companion_radio.

    Optional companion settings in config.ini:

    • COMPANION_HANDSHAKE_ENABLED = True (send initial device query/app start)
    • COMPANION_CONTACTS_POLL_S = 0 (poll contacts/adverts; 0 disables)
    • COMPANION_DEBUG = False (enable raw byte logging)
  • For MQTT:
    Set EXTERNAL_TRANSPORT = mqtt and configure broker details. Optionally enable TLS/SSL for secure connections.

  • For REST API (Optional):
    Set API_ENABLED = True and configure API_HOST and API_PORT to enable the monitoring API.

Run (Sync or Async)

  • Synchronous (legacy): python run_bridge.py

  • Async (recommended, for meshcore_py and async MQTT): python run_bridge_async.py

The async entry point supports:

  • Async Meshcore integration (meshcore_py)
  • Async MQTT (asyncio-mqtt)
  • Async REST API (FastAPI, if enabled)

Async API Server

If API_ENABLED = True in your config, the async bridge will launch a FastAPI server for health, metrics, and control endpoints (see below).

REST API Endpoints (if enabled)

Endpoints are available on the configured API host/port (default: http://127.0.0.1:8080):

  • GET /api/health — Health status of all components
  • GET /api/metrics — Detailed metrics and statistics
  • GET /api/status — Combined health and metrics
  • GET /api/info — Bridge information
  • POST /api/control — Control actions (e.g., reset metrics)

Example: curl http://localhost:8080/api/health curl http://localhost:8080/api/metrics


Maintainer / Contact

This project is maintained by Akita Engineering.


License

This project is licensed under the GNU General Public License v3.0.
(See the LICENSE file for the full license text.)

Description
No description provided
Readme GPL-3.0 306 KiB
Languages
Python 100%