feat(MQTT): rebuild topic spec to v2 (F-062)

Full MQTT topic rebuild per docs/reference/vesper_mqtt_topic_spec_v2.md.
Only the MQTT transport path changed — WebSocket, HTTP, and UART are untouched.

- control/command (in) + control/ack (out, strictly replies) replace the old
  control/data pair; new control/reports for critical unsolicited events
  (bell overload) that don't belong on the strictly-reply ack channel
- status/playback split out for playback transitions only
- status/alerts + status/info renamed to system/alerts + system/info, both
  now correctly retained; new system/logs and system/metrics (diagnostics
  report moved here from system/info, gained bell strike/heat data)
- LWT registered for the first time — status/heartbeat gets
  {"state":"offline","ok":false} on an unclean disconnect; graceful
  disconnect (mqtt.disable) announces offline explicitly since LWT doesn't
  fire on a clean disconnect
- heartbeat payload flattened, gains independently-derived state/ok fields
  (via a new MQTTDriver::setStateProvider() wired from Player+HealthMonitor)
- optional req_id correlation added bus-wide (CommandEnvelope/CommandResult),
  not MQTT-only, since any transport with multiple senders sharing one
  channel has the same problem. Always optional — v1 clients unaffected.
- per-topic ON/OFF switches (ConfigManager::MqttTopicConfig, 8 flags) as
  sub-switches under the existing mqtt.enable/disable master switch, so a
  device can breathe by disabling topics it doesn't need. New
  mqtt.get_topics/mqtt.set_topics commands; command switch applies live.

Bumped to v2.2.0. Verified: pio run -e vesper-std-v1 -e agnus-v1 both build clean.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-21 10:48:36 +03:00
co-authored by Claude Sonnet 5
parent 20576f12ff
commit 391ecb63fc
26 changed files with 1053 additions and 330 deletions
+1 -1
View File
@@ -200,7 +200,7 @@ A second, lower-frequency reporting mechanism alongside boot tracking above —
**Why temperature alone needs local sampling, and the other three don't:** temperature genuinely fluctuates between reports — a short thermal spike (e.g. a burst of relay activity) could occur and fully subside within the 5-minute gap between two reports, and a device reporting only its *current* value at report time would simply never see it. The other three fields are all monotonic or self-tracking (a reconnect counter only grows; `uxTaskGetStackHighWaterMark()` is itself already a running minimum since task start; OTA state changes only around an actual update) — reading them more often than once per report cannot reveal information a less-frequent read would miss.
**Publish cadence.** `CommunicationRouter::reportDiagnosticsIfDue()` checks a `millis()`-diff every main-loop iteration (same lightweight pattern as this class's own `RUNTIME_FLUSH_INTERVAL_MS` check — no new FreeRTOS timer) and publishes to `vesper/{uid}/status/info` every `DIAGNOSTICS_REPORT_INTERVAL_MS` (5 minutes) once `_telemetry` is set. See [CommunicationRouter's README](../Communication/CommunicationRouter/README.md) for the full payload shape.
**Publish cadence.** `CommunicationRouter::reportDiagnosticsIfDue()` checks a `millis()`-diff every main-loop iteration (same lightweight pattern as this class's own `RUNTIME_FLUSH_INTERVAL_MS` check — no new FreeRTOS timer) and publishes to `vesper/{uid}/system/metrics` every `DIAGNOSTICS_REPORT_INTERVAL_MS` (5 minutes) once `_telemetry` is set. Also includes per-bell strike/load data (via `getStrikeCount()`/`getBellLoad()`/`isCoolingActive()`) since moving to the `system/metrics` topic — see [CommunicationRouter's README](../Communication/CommunicationRouter/README.md) for the full payload shape.
**On-demand vs. periodic — the accumulator reset distinction.** `telemetry.get_diagnostics` (`TelemetryHandler`) returns the identical shape but calls `writeTemperatureStats()` — a peek — instead of resetting the accumulator afterward. This means polling the command doesn't rob the next scheduled periodic report of samples it would otherwise have seen; only the periodic path's own `resetDiagnosticsStats()` call clears the window.