diff --git a/MQTT_OBSERVER.md b/MQTT_OBSERVER.md index 3cb33b9c..f1a027c4 100644 --- a/MQTT_OBSERVER.md +++ b/MQTT_OBSERVER.md @@ -3,7 +3,7 @@ MQTT observer builds publish successfully parsed packets heard over radio. The receive hook runs before forwarding policy, so packet filters, the battery gate, repeat enablement, hop/loop limits, and region policy do not suppress -observations. This is a best-effort, live feed—not a packet archive. +observations. This is a best-effort feed, not a packet archive. ## Build target and status @@ -11,119 +11,139 @@ The optional targets are defined in [`observer_targets.ini`](./observer_targets. which is also the allowlist used by `build.sh`: ```sh -pio run -e Xiao_S3_WIO_repeater_observer_mqtt +pio run -e Xiao_S3_WIO_repeater_observer ``` -Only the XIAO S3 WIO target is currently listed. It compiles, but still needs -on-device memory, RF-load, TLS, broker, and OTA acceptance testing. Treat it as -experimental until those checks are complete. Standard repeater targets do not -depend on the MQTT library or compile observer sources. Optional release builds -can be selected separately with `scripts/local-release-build.sh --observers -`. +Observer-enabled Repeater targets cover the supported Observer board list: +Heltec T190, Tracker V1.1 and V2, V3, WSL3, V4 and V4 ExpansionKit; LilyGo +T3-S3 SX1262, T-Beam 1W, T-Beam S3 Supreme SX1262, T-Beam SX1262 and SX1276; +RAK 3112; Station G2 and G3; ThinkNode M7; and XIAO S3 WIO. +Room Server targets are intentionally not included. All 17 Repeater target +environments compile, but still need per-board memory, RF-load, TLS, broker, and +OTA acceptance testing; treat them as experimental until those checks are +complete. The T3-S3 and T-Beam 1W observer targets use `min_spiffs.csv`, and +Station G2/G3 use `default_16MB.csv`, to fit the larger app. Those partition +overrides can require a merged image when converting an existing node and may +reset filesystem-backed settings. Standard repeater targets do not depend on +the MQTT library or compile observer sources. Optional release builds can be +selected separately with +`scripts/local-release-build.sh --observers `. The MIT-licensed PsychicMqttClient is pinned to commit `9e3005571918fdd83a2521243c501d1af137b0b6`. TLS uses the ESP32 Arduino CA bundle with certificate validation and needs a valid device clock. JWT -authentication uses the MeshCore Ed25519 identity and broker-specific audience. +authentication uses the MeshCore Ed25519 identity and a per-broker audience. ## Configure -The observer is disabled on a fresh install. This build uses the same shared -MQTT command names as agessaman's observer. Since it has one broker, the -reference's slot settings (`mqtt1.*`) are unnumbered `mqtt.*` settings: +The observer is disabled on a fresh install and supports two independent MQTT +broker slots. Broker-specific settings always use numbered commands (`mqtt1.*`, +`mqtt2.*`) to match agessaman's CLI; unnumbered `mqtt.*` commands are only for +shared settings such as IATA, origin, and publish switches. Broker credentials +and topic templates are independent. Wi-Fi, IATA, origin, NTP, status interval, +and packet/status/raw enable switches are shared. ```text set wifi.ssid YourNetwork set wifi.pwd YourWiFiPassword -set mqtt.server wss://broker.example:443/mqtt -set mqtt.audience broker.example +set mqtt1.server wss://first.example:443/mqtt +set mqtt1.audience first.example +set mqtt2.server mqtts://second.example:8883 +set mqtt2.username observer +set mqtt2.password secret set mqtt.iata SEA -set mqtt on +set mqtt1.enabled on +set mqtt2.enabled on get mqtt.status +get mqtt1.status +get mqtt2.status ``` -The server can also be configured as a hostname and port separately: +For a username/password connection, set that slot's `username` and `password` +and leave its `audience` empty. JWT mode takes precedence when that slot has an +audience configured; it uses username `v1_` and a 24-hour Ed25519-signed token. The +worker waits for valid time before connecting and renews tokens before expiry. +Optional per-slot `owner` and `email` values are included in JWT claims. Secrets +are not echoed by set/get replies or fleet-script logs. + +A server may be configured as a hostname and port separately. Use `mqtts://` +for MQTT over TLS, `wss://` for secure WebSockets, `mqtt://` for trusted private +networks, or `ws://` for trusted private networks. Secure URLs retain hostname +and certificate verification. Do not use plain transport on an untrusted +network. URLs must not contain embedded `username:password@` credentials. With +a full URL, an explicit URL port takes precedence; otherwise that slot's +`mqttN.port` supplies the port. Host-only values infer `mqtts://` for port 8883, +`wss://` for 443, and `mqtt://` otherwise. + +Supported commands include: ```text -set mqtt.server broker.example -set mqtt.port 1883 -``` - -Use `mqtts://` for MQTT over TLS, `wss://` for MQTT over secure WebSockets, -`mqtt://` for trusted private networks, or `ws://` for trusted private -networks. Secure URLs retain hostname and certificate verification. Do not use -plain transport on an untrusted network. URLs must not contain embedded -`username:password@` credentials. With a full URL, an explicit URL port takes -precedence; otherwise `mqtt.port` supplies the port. Host-only values infer -`mqtts://` for port 8883, `wss://` for 443, and `mqtt://` otherwise. - -For username/password authentication, set `mqtt.username` and `mqtt.password` -and clear the JWT audience. JWT mode takes precedence whenever an audience is -configured; it uses username `v1_` and a 24-hour Ed25519-signed -token. The worker waits for valid time before connecting and renews the token -before expiry. Optional `mqtt.owner` and `mqtt.email` values are included in -JWT claims. Secrets are not echoed by set/get replies or fleet-script logs. - -Supported commands: - -```text -set mqtt.origin # empty follows the repeater node name -set mqtt.iata # 3 letters/digits, auto-uppercased; XXX reserved -set mqtt.server -set mqtt.port <1-65535> -set mqtt.username -set mqtt.password -set mqtt.audience # empty clears JWT mode -set mqtt.owner # optional JWT claim -set mqtt.email # optional JWT claim -set mqtt.topic