Skip to content

Ethernet MQTT observer voor RAK4631 + RAK13800 - #6

Open
hp197 wants to merge 1 commit into
Dutch-MeshCore:mqtt-bridge-implementation-flex-dmcfrom
hp197:feature/rak4631-ethernet-mqtt
Open

hp197 wants to merge 1 commit into
Dutch-MeshCore:mqtt-bridge-implementation-flex-dmcfrom
hp197:feature/rak4631-ethernet-mqtt

Conversation

@hp197

@hp197 hp197 commented Oct 10, 2026 •

Copy link
Copy Markdown

Deze PR voegt een MQTT observer build toe voor de RAK4631 die via bekabeld Ethernet verbindt met de RAK13800 (W5100S) module. Zo kun je een observer draaien zonder WiFi.

Het doelapparaat is de RAK WisMesh Ethernet MQTT Gateway (RAK4631 + RAK13800): https://docs.rakwireless.com/product-categories/meshtastic/wismesh-eth-mqtt-gw/quickstart/

De build target is RAK_4631_repeater_observer_mqtt_eth. De node krijgt een adres via DHCP en verbindt standaard met dutchmeshcore-1 en dutchmeshcore-2. Getest op een echte node en het werkt.

Wat er veranderd is

De ESP32 observer gebruikt WiFi en de TLS-libraries van de ESP32, en die bestaan niet op de nRF52. Daarom heeft de Ethernet-versie een eigen bridge-implementatie, maar met dezelfde class-naam en functies als de WiFi-versie. De rest van de firmware (repeater, CLI, alerts, berichtformaat) is gedeeld en ongewijzigd.

Nieuwe bestanden:

  • MQTTBridgeEthernet: de bridge zelf. Al het netwerkverkeer draait in een eigen taak, zodat de mesh blijft werken terwijl er verbinding wordt gemaakt.
  • BearTLSClient: TLS 1.2 met BearSSL. Vertrouwt dezelfde rootcertificaten die al in de presets staan.
  • WSClient: een kleine WebSocket-client, nodig voor de wss:// collectors.

De pinindeling is gelijk aan de werkende rak4631_eth_gw configuratie van Meshtastic.

CLI

  • get eth.status toont link, IP, MAC en uptime. get wifi.status geeft op deze build hetzelfde.
  • get mqtt.status en get mqttN.diag werken zoals voorheen.
  • Alerts noemen "Ethernet" in plaats van "WiFi".

Reparaties voor de gewone RAK4631 builds

De normale RAK4631 repeater builds compileerden niet meer op deze branch. Opgelost door:

  • de MQTT-helpers alleen te compileren als MQTT aan staat
  • de mbedTLS-afhankelijkheid uit de JWT base64-code te halen
  • het memory commando ook op nRF52 te laten werken
  • de ESP32-only MQTT-library uit te sluiten voor nRF52 builds

Beperkingen

  • Maximaal 2 MQTT-verbindingen tegelijk (beperkt door RAM en de 4 sockets van de W5100S).
  • Alleen DHCP, nog geen vast IP.
  • Eigen mqtts:// of wss:// brokers moeten een certificaat van Let's Encrypt of Google Trust Services hebben. Alle huidige presets voldoen daaraan.
  • Flashgebruik is ongeveer 90%.

Getest

  • Builds: RAK_4631_repeater, RAK_4631_repeater_observer_mqtt_eth en RAK_3112_repeater_observer_mqtt
  • Geflasht op een RAK4631 met RAK13800, werkt

@hp197 hp197 changed the title Add Ethernet MQTT observer for RAK4631 + RAK13800 Ethernet MQTT observer voor RAK4631 + RAK13800 Oct 10, 2026
@hp197

hp197 commented Oct 10, 2026

Copy link
Copy Markdown
Author

@hp197
hp197 force-pushed the feature/rak4631-ethernet-mqtt branch from bd0688c to 62f91bd Compare October 10, 2026 22:47
New build target RAK_4631_repeater_observer_mqtt_eth: MQTT bridge over wired
Ethernet for the nRF52-based RAK4631 with a RAK13800 in the IO slot (same pin
mapping as Meshtastic's rak4631_eth_gw).

- MQTTBridgeEthernet: same MQTTBridge class/API as the ESP32 WiFi bridge, so
  MyMesh, CommonCLI and AlertReporter work unchanged. Network I/O runs in its
  own FreeRTOS task; the W5100S is never touched from the mesh loop.
- BearTLSClient: BearSSL TLS 1.2 client on any Arduino Client, full 16 KB input
  record buffer, trust anchors decoded at runtime from the preset CA PEMs.
- WSClient: RFC 6455 client (subprotocol "mqtt") exposed as an Arduino Client.
- Stack per slot: PubSubClient -> WSClient -> BearTLSClient -> EthernetClient,
  supporting mqtt://, mqtts://, ws:// and wss:// incl. Ed25519 JWT presets
  (dutchmeshcore-1/2 by default). Max 2 active slots.
- CLI: 'get eth.status' (wifi.status maps to it); alerts say "Ethernet".
- Uses upstream's ETHERNET_ENABLED flag (not a fork-specific WITH_ETHERNET), so
  RAK4631Board.cpp gets upstream's early WB_IO2 power-on constructor (PoE boot).
  The constructor is byte-identical to upstream so a future merge stays clean.

Also fixes the plain nRF52 builds, which no longer compiled on this branch:
- JWTHelper / MQTTMessageBuilder only compile with WITH_MQTT_BRIDGE
- JWTHelper base64url no longer depends on mbedTLS
- 'memory' CLI command is platform specific
- nrf52_base ignores the ESP-IDF-only PsychicMqttClient library

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@hp197
hp197 force-pushed the feature/rak4631-ethernet-mqtt branch from 62f91bd to 7eff0fd Compare October 11, 2026 12:10

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant