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.
- 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. Includesraw_serialandcompanion_radiohandlers for MeshCore Companion Mode (Binary + framed USB protocol). - Robust Connection Management: Automatically attempts to reconnect if connections are lost.
- 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
git clone https://github.com/AkitaEngineering/akita-meshtastic-meshcore-bridge.git
cd akita-meshtastic-meshcore-bridge
python -m venv venv
source venv/bin/activate # or .\venv\Scripts\activate on Windows
pip install -r requirements.txt
Copy examples/config.ini.example to config.ini and edit it.
-
For MeshCore (Companion USB):
SetEXTERNAL_TRANSPORT = serialandSERIAL_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)SERIAL_AUTO_SWITCH = True(auto-switch betweenjson_newlineandraw_serialon repeated decode failures)
-
For MQTT:
SetEXTERNAL_TRANSPORT = mqttand configure broker details. Optionally enable TLS/SSL for secure connections. -
For REST API (Optional):
SetAPI_ENABLED = Trueand configureAPI_HOSTandAPI_PORTto enable the monitoring API.
-
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) with
CONTACT_MSG_RECVandCHANNEL_MSG_RECVsubscriptions - Async MQTT (asyncio-mqtt)
- Async REST API (FastAPI, if enabled)
If API_ENABLED = True in your config, the async bridge will launch a FastAPI server for health, metrics, and control endpoints (see below).
Endpoints are available on the configured API host/port (default: http://127.0.0.1:8080):
GET /api/health— Health status of all componentsGET /api/metrics— Detailed metrics and statisticsGET /api/status— Combined health and metricsGET /api/info— Bridge informationPOST /api/control— Control actions (e.g., reset metrics)
Example: curl http://localhost:8080/api/health curl http://localhost:8080/api/metrics
This project is maintained by Akita Engineering.
- Website: www.akitaengineering.com
- Contact: info@akitaengineering.com
This project is licensed under the GNU General Public License v3.0.
(See the LICENSE file for the full license text.)