TCP-Proxy der einen MeshCore-Node an der USB-Schnittstelle transparent ins Netzwerk bringt, sodass mehrere Clients gleichzeitig darauf zugreifen können.
- Python 98.8%
- Shell 1.2%
Neues Verzeichnis docs/ mit vollständiger technischer Dokumentation:
- docs/BESCHREIBUNG.md – Markdown-Version
- docs/BESCHREIBUNG.docx – Word-Dokument mit formatierter Darstellung
Inhalt:
1. Zweck und Motivation
2. Systemarchitektur (ASCII-Diagramm + Datenfluss)
3. MeshEvent Datenmodell
4. Scope-Handling (Extraktion, MQTT-Topics, Filter)
5. Robustheit gegen Scope-Flooding
- Token-Bucket Rate-Limiter
- Persistente MQTT-Connection vs. Connection-Churn
- Queue-basierter Fan-Out (QueuedClientMixin)
- FileLog-Rotation
- Gesamtübersicht aller Massnahmen
6. Output-Plugins im Detail
7. Konfigurationsreferenz
8. Installation und Betrieb
9. Bewertung verwandter Projekte
10. Bezug zu MeshDresden / Funkturm Wilsdruff
|
||
|---|---|---|
| config | ||
| docs | ||
| .gitignore | ||
| CLAUDE.md | ||
| demo_mode.py | ||
| example_consumer.py | ||
| meshcore-proxy.service | ||
| proxy.py | ||
| README.md | ||
| requirements.txt | ||
| setup.sh | ||
MeshCore Message Proxy – MeshDresden Edition
Ein Python-basierter Message-Broker für MeshCore-Nachrichten, der eine einzelne Radio-Verbindung an beliebig viele Consumer-Anwendungen verteilt.
Architektur
MeshCore Radio (Serial / TCP)
│
▼
┌────────────────────────────────────────┐
│ MeshCore Proxy │
│ │
│ MeshCoreConnector (meshcore Python) │
│ │ empfängt Events │
│ ▼ │
│ EventBus (pub/sub) │
│ │ verteilt an Plugins │
│ ▼ │
│ ┌──────┬────────┬──────┬──────────┐ │
│ │ WS │ MQTT │ TCP │ File │ │
│ │8765 │Broker │5001 │ JSONL │ │
│ └──────┴────────┴──────┴──────────┘ │
└────────────────────────────────────────┘
▼ ▼ ▼ ▼
Dashboard meshdresden Bots Archiv
WebApp v2 .eu MQTT
Installation
git clone https://forgejo.example.com/peter/meshcore-proxy.git
cd meshcore-proxy
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Konfiguration anpassen
cp config/proxy.yaml.example config/proxy.yaml
nano config/proxy.yaml
# Starten
python3 proxy.py -c config/proxy.yaml
# Demo-Modus (ohne echtes Radio)
python3 demo_mode.py
Systemd-Deployment
sudo cp meshcore-proxy.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now meshcore-proxy
sudo journalctl -u meshcore-proxy -f
Verfügbare Plugins
| Plugin | Port | Protokoll | Beschreibung |
|---|---|---|---|
| websocket | 8765 | WS/JSON | Dashboard, Browser-Apps |
| mqtt | – | MQTT | meshdresden.eu Broker |
| tcp_fanout | 5001 | TCP/JSONL | Bots, Monitoring, Legacy-Apps |
| file_log | – | JSONL-Datei | Archivierung, Analyse |
| telegram | – | HTTP | MeshDD Telegram-Community |
Eigene Plugins erstellen
from proxy import BasePlugin, MeshEvent, EventBus
class MeinPlugin(BasePlugin):
name = "mein_plugin"
async def start(self):
await super().start() # registriert on_event am Bus
async def on_event(self, event: MeshEvent):
if event.event_type == "MSG_RECV":
text = event.payload.get("text", "")
# ... eigene Verarbeitung
Plugin in PLUGIN_REGISTRY in proxy.py eintragen und in config/proxy.yaml konfigurieren.
Bewertung verwandter Projekte
meshcore-proxy (rgregg/meshcore-proxy) ⭐⭐⭐⭐
- Funktion: Serial/BLE → TCP (1:1 Proxy, kein Fan-Out)
- Gut: Produktionsreif, pip-installierbar, systemd-Beispiel vorhanden
- Nachteil: Nur ein TCP-Client gleichzeitig; keine Event-Filterung; kein MQTT
- Verwendung hier: Kann als vorgelagerter TCP-Endpunkt genutzt werden
(
nodes[].type: tcp→ verbindet auf meshcore-proxy Port 5000)
MeshMonitor Virtual Node Server (Yeraze/meshmonitor) ⭐⭐⭐⭐⭐
- Funktion: Meshtastic-Proxy mit Caching für 3-5+ mobile Apps gleichzeitig
- Gut: Multi-Client TCP, Config-Caching (240+ Nachrichten), Message-Queuing
- Nachteil: Nur Meshtastic, kein MeshCore; Node.js statt Python
- Inspiriert hier: TCPFanOutPlugin (Multi-Client-Konzept), EventBus-Architektur
meshcore_py (meshcore-dev/meshcore_py) ⭐⭐⭐⭐⭐
- Funktion: Offizielle Python-Bindings
- Gut: Aktiv gepflegt (März 2026), asyncio-nativ, Serial/BLE/TCP
- Verwendung hier: Direkt als Connector-Bibliothek (MeshCoreConnector)
meshtui TCP Proxy ⭐⭐⭐
- Funktion: Experimental TCP Proxy für meshtui TUI-Client
- Gut: Einfache Integration
- Nachteil: Experimental, kein Multi-Consumer
meshcore-pi (brianwiddas) ⭐⭐⭐⭐
- Funktion: Vollständige Python-MeshCore-Implementierung für Raspberry Pi
- Gut: Multi-Interface (LoRa + ESP-NOW), Companion+Repeater+Room möglich
- Nachteil: Sehr low-level, keine message-broker Funktionalität
- Interessant: Bridge-Konzept (LoRa ↔ ESP-NOW) als Inspiration für zukünftigen Packet↔MeshCore Gateway
Fazit
Der hier entwickelte Proxy kombiniert das Multi-Client-Konzept von MeshMonitor, die offiziellen Python-Bindings von meshcore-dev und einen modularen Plugin-Bus, der für MeshDD-spezifische Integrationen (MQTT-Broker, Telegram, WebApp v2) optimiert ist.