docs(ApiReference): add mqtt.status; playback/reports QoS 1 (confirmed), other outbound topics QoS 0

Mirrors firmware F-071..F-073 (project-vesper, v2.4.0):
- New mqtt.status command (MQTT connection health: connect/disconnect
  counters, last disconnect reason, forced self-recovery resets and reason,
  resent_messages).
- status/playback and control/reports are QoS 1 with PUBACK tracking
  (playback republished on reconnect, reports resent); control/ack, alerts
  and info are QoS 0. Heartbeat unchanged (QoS 1).

Verified the page parses with esbuild.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-15 22:53:43 +03:00
co-authored by Claude Opus 5.5
parent 18705aaefb
commit bbd356d846
@@ -16,12 +16,12 @@ import Tabs from '@/components/ui/Tabs'
// control/command + control/ack which share one switch ("command").
const TRANSPORTS_V2 = [
{ transport: 'MQTT', address: 'vesper/{device_id}/control/command', direction: 'Inbound', switch: 'command', notes: 'Read-only from the board\'s perspective — commands in. Replies go to control/ack. Optional req_id for correlation.' },
{ transport: 'MQTT', address: 'vesper/{device_id}/control/ack', direction: 'Outbound, QoS 1', switch: 'command', notes: 'Strictly replies to commands (incl. pong) — nothing unsolicited is ever published here. Echoes req_id when the request sent one.' },
{ transport: 'MQTT', address: 'vesper/{device_id}/control/reports', direction: 'Outbound, QoS 1', switch: 'reports', notes: 'Critical, unsolicited, time-sensitive board-initiated events (bell_overload, playback_failed). Not retained. The phone app should subscribe for playback_failed.' },
{ transport: 'MQTT', address: 'vesper/{device_id}/control/ack', direction: 'Outbound, QoS 0', switch: 'command', notes: 'Strictly replies to commands (incl. pong) — nothing unsolicited is ever published here. Echoes req_id when the request sent one.' },
{ transport: 'MQTT', address: 'vesper/{device_id}/control/reports', direction: 'Outbound, QoS 1 (confirmed, resent after reconnect)', switch: 'reports', notes: 'Critical, unsolicited, time-sensitive board-initiated events (bell_overload, playback_failed). Not retained. The phone app should subscribe for playback_failed.' },
{ transport: 'MQTT', address: 'vesper/{device_id}/status/heartbeat', direction: 'Outbound, retained, QoS 1', switch: 'heartbeat', notes: 'Every 30 s. Also carries LWT — broker publishes {"state":"offline","ok":false} on an unclean disconnect.' },
{ transport: 'MQTT', address: 'vesper/{device_id}/status/playback', direction: 'Outbound, retained, QoS 1', switch: 'playback', notes: 'Playback state transitions (loading/playing/paused/stopping/idle) with pid, speed, duration, started_at, source, ts. Published on transition, not polled — plus on every MQTT (re)connect with the current real state, so a stale retained "playing" never outlives a reboot. Source of truth for what the board is doing.' },
{ transport: 'MQTT', address: 'vesper/{device_id}/system/alerts', direction: 'Outbound, retained until cleared, QoS 1', switch: 'alerts', notes: 'Subsystem state changes (WARNING / CRITICAL / FAILED / CLEARED). Published on transition only.' },
{ transport: 'MQTT', address: 'vesper/{device_id}/system/info', direction: 'Outbound, retained, QoS 1', switch: 'info', notes: 'Discrete system events, e.g. boot_report on every boot.' },
{ transport: 'MQTT', address: 'vesper/{device_id}/status/playback', direction: 'Outbound, retained, QoS 1 (confirmed)', switch: 'playback', notes: 'Playback state transitions (loading/playing/paused/stopping/idle) with pid, speed, duration, started_at, source, ts. Published on transition, not polled — plus on every MQTT (re)connect with the current real state, so a stale retained "playing" never outlives a reboot. Source of truth for what the board is doing.' },
{ transport: 'MQTT', address: 'vesper/{device_id}/system/alerts', direction: 'Outbound, retained until cleared, QoS 0', switch: 'alerts', notes: 'Subsystem state changes (WARNING / CRITICAL / FAILED / CLEARED). Published on transition only.' },
{ transport: 'MQTT', address: 'vesper/{device_id}/system/info', direction: 'Outbound, retained, QoS 0', switch: 'info', notes: 'Discrete system events, e.g. boot_report on every boot.' },
{ transport: 'MQTT', address: 'vesper/{device_id}/system/logs', direction: 'Outbound, QoS 0', switch: 'logs', notes: 'Full log stream, mirrors serial output. Also gated by the log.set_mqtt level, independently of this switch.' },
{ transport: 'MQTT', address: 'vesper/{device_id}/system/metrics', direction: 'Outbound, QoS 0', switch: 'metrics', notes: 'Structured telemetry every 5 min — CPU temp, WiFi/OTA state, stack high-water marks, bell strike/heat data.' },
{ transport: 'WebSocket', address: 'ws://{device_ip}/ws', direction: 'Bidirectional', switch: null, notes: 'Send identify on connect. Missing "v" defaults to v1 (legacy adapter). req_id is ignored — replies never carry it.' },
@@ -1086,6 +1086,17 @@ const NAMESPACES = [
example: '{ "v": 2, "cmd": "mqtt.get_config" }',
warning: null,
},
{
cmd: 'mqtt.status',
handler: 'MQTTHandler',
transports: ['All'],
description: 'MQTT connection health since boot: connect/disconnect counters, last disconnect reason, and how often the firmware\'s self-recovery had to force a reset. Works on every transport, so send it over WebSocket when the console shows a device offline but the local app still works. *_ago_ms and connected_for_ms are 0 when the event never happened / not connected. last_forced_reset_reason is "connect attempt stuck", "heartbeat PUBACK timeout", "playback PUBACK timeout" or "report PUBACK timeout" (empty if self-recovery never fired). resent_messages counts control/reports messages republished after a reconnect because their PUBACK never came.',
contents: null,
response: '{\n "status": "SUCCESS",\n "type": "mqtt.status",\n "data": {\n "enabled": true,\n "connected": true,\n "connected_for_ms": 5412000,\n "connects": 3,\n "disconnects": 2,\n "reconnect_attempts": 0,\n "last_disconnect_reason": "TCP disconnected",\n "last_disconnect_ago_ms": 5420000,\n "forced_resets": 1,\n "last_forced_reset_reason": "heartbeat PUBACK timeout",\n "last_forced_reset_ago_ms": 5425000,\n "resent_messages": 0,\n "wifi_connected": true,\n "free_heap": 84212\n }\n}',
errors: [],
example: '{ "v": 2, "cmd": "mqtt.status" }',
warning: null,
},
{
cmd: 'mqtt.get_topics',
handler: 'MQTTHandler',
@@ -1923,7 +1934,7 @@ function TransportsV2() {
</div>
</Card>
<Card title="Status Alerts Payload" subtitle="Published on subsystem state transitions to vesper/{device_id}/system/alerts — QoS 1, retained until cleared">
<Card title="Status Alerts Payload" subtitle="Published on subsystem state transitions to vesper/{device_id}/system/alerts — QoS 0, retained until cleared">
<div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--space-4)' }}>
<MonoBlock code={'{\n "subsystem": "System",\n "state": "WARNING",\n "msg": "Device reset due to fault: PANIC"\n}'} />
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(160px, 1fr))', gap: 'var(--space-3)' }}>
@@ -1944,7 +1955,7 @@ function TransportsV2() {
</div>
</Card>
<Card title="Boot Report Payload" subtitle="Published once per boot, on first MQTT connect, to vesper/{device_id}/system/info — QoS 1, retained">
<Card title="Boot Report Payload" subtitle="Published once per boot, on first MQTT connect, to vesper/{device_id}/system/info — QoS 0, retained">
<div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--space-4)' }}>
<MonoBlock code={'{\n "type": "boot_report",\n "payload": {\n "boot_count": 47,\n "reset_reason": "PANIC",\n "is_fault": true,\n "free_heap": 187234,\n "crash": {\n "task": "async_tcp",\n "pc": 1074282197,\n "exc_cause": 29,\n "exc_vaddr": 0,\n "backtrace": [1074282194, 1074340312, 1074348122],\n "backtrace_corrupted": false,\n "elf_sha256": "3f9a1c0be7d2a441"\n },\n "pre_crash": {\n "uptime_ms": 5412000,\n "free_heap": 21480,\n "largest_block": 9716,\n "min_free_heap": 18112,\n "abort_msg": "abort() was called at PC 0x400d8a3f on core 0"\n }\n }\n}'} />
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(160px, 1fr))', gap: 'var(--space-3)' }}>