docs(playback): formally document the "stopping" status/playback state (F-065)
Player::setStatus() publishes action "stopping" when the run-time cap is reached and BellEngine is finishing the current melody loop, but the spec only listed playing/paused/idle. Kept it (not suppressed): it is a real state that can last a whole loop while bells still ring, suppressing it on MQTT alone would break WS/MQTT parity, and v1 tablets already know it. Adds a state table (entry/exit, stop/play behaviour) to mqtt-events.md and updates the topic spec and API reference. No firmware change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -167,7 +167,7 @@ Both commands reply with **`type: "playback"`** (not the command name).
|
||||
| Transports | MQTT, WebSocket, HTTP (UART: v1 form only) |
|
||||
| Returns | `{ "status": "SUCCESS", "type": "playback", "message": "Playback command executed" }` |
|
||||
|
||||
The SUCCESS reply means the board **accepted** the command, not that bells are ringing. `status/playback` (MQTT) is the source of truth for what the board is actually doing.
|
||||
The SUCCESS reply means the board **accepted** the command, not that bells are ringing. `status/playback` (MQTT) is the source of truth for what the board is actually doing — `playing` / `paused` / `stopping` / `idle`; see [mqtt-events.md → States](mqtt-events.md#states).
|
||||
|
||||
**Fields are sticky.** Every field except `mode`/`continuous_loop` keeps the value from the *previous* `playback.play` (or its boot default) when omitted — including `pid`, `url`, `speed` and the tail of `note_assignments`. Send every field you care about on every play.
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ Flat — no envelope wrapper.
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `action` | string | `playing` \| `paused` \| `idle` |
|
||||
| `action` | string | `playing` \| `paused` \| `stopping` \| `idle` — see [States](#states) |
|
||||
| `time_elapsed` | integer | Seconds since playback started, as of `ts` (0 for `idle`) |
|
||||
| `projected_run_time` | integer | Projected total run time in ms (0 if not applicable) |
|
||||
| `pid` | string | Melody being played (`""` when idle) |
|
||||
@@ -129,6 +129,17 @@ Flat — no envelope wrapper.
|
||||
|
||||
The WebSocket transport receives the same fields on every transition, wrapped in the legacy broadcast envelope: `{ "status": "INFO", "type": "playback", "payload": { ...fields above... } }`.
|
||||
|
||||
### States
|
||||
|
||||
| `action` | Meaning | Entered from | Leaves to |
|
||||
|---|---|---|---|
|
||||
| `playing` | Bells are ringing. | `idle` (play accepted), `paused` (segment pause over) | `paused`, `stopping`, `idle` |
|
||||
| `paused` | Between segments of an `interval` (or legacy `continuous_loop`) play — bells silent, playback still active. | `playing` | `playing`, `idle` |
|
||||
| `stopping` | The run-time cap (`duration`) has elapsed; the bells are **finishing the current melody loop** before stopping (can last up to one full loop, i.e. steps × `speed`). Still ringing. | `playing` (timer reached `duration`) | `idle` (loop finished) |
|
||||
| `idle` | Nothing playing. | any (`playback.stop`, natural end, overload force-stop) | `playing` |
|
||||
|
||||
`playback.stop` during `playing`/`paused`/`stopping` cuts the bells immediately and goes straight to `idle` — it never passes through `stopping`. A new `playback.play` is rejected in every state except `idle`. The heartbeat's independently-derived `state` reports `idle` during `stopping`.
|
||||
|
||||
---
|
||||
|
||||
## `vesper/{id}/control/reports`
|
||||
|
||||
@@ -12,7 +12,7 @@ and [MQTTTransport](../../src/Communication/Transport/MQTTTransport/README.md) (
|
||||
| `vesper/{device_id}/control/ack` | Replies to commands, including `pong` | 1 | No | `command` | **Strictly replies only — every message here answers a specific request, and every reply goes here. Nothing unsolicited is ever published to this topic.** Echoes `req_id` from the originating command when one was sent. `status: SUCCESS/ERROR/INFO`, `type`, optional `message`/`data`. Malformed input (invalid JSON, missing `cmd`) also gets an `ERROR` reply here (`type: "parse_error"`) rather than being silently dropped — see [Malformed input](#malformed-input) below. |
|
||||
| `vesper/{device_id}/control/reports` | Critical, time-sensitive board-initiated events (e.g. bell overload) | 1 | No | `reports` | The opposite of `control/command` — unsolicited data the board sends because it needs to be read *now*. Not a reply to anything, no `req_id`. Not retained — an event stream, not a status snapshot. |
|
||||
| `vesper/{device_id}/status/heartbeat` | Periodic health/state summary, every 30s | 1 | **Yes** | `heartbeat` | Also carries LWT (see below). Fields: `device_id`, `state` (`idle`/`playing`/`paused`/`error`/`booting`), `ok` (bool), `fw_version`, `uptime_ms`, `uptime_human`, `ip_address`, `gateway`, `rssi`, `free_heap` — `state`/`ok` independently derived, never mirrored from `status/playback` or `system/alerts`. |
|
||||
| `vesper/{device_id}/status/playback` | Playback state transitions only | 1 | **Yes** | `playback` | `action`: `playing`/`paused`/`idle`, plus `time_elapsed`, `projected_run_time`, `pid`, `speed`, `duration`, `started_at`, `source`, `ts` — see [mqtt-events.md](mqtt-events.md#vesperidstatusplayback). Published on transition, not polled. Source of truth for what the board is doing (a `control/ack` SUCCESS only means "accepted"). |
|
||||
| `vesper/{device_id}/status/playback` | Playback state transitions only | 1 | **Yes** | `playback` | `action`: `playing`/`paused`/`stopping`/`idle` (`stopping` = run-time cap reached, bells finishing the current loop), plus `time_elapsed`, `projected_run_time`, `pid`, `speed`, `duration`, `started_at`, `source`, `ts` — see [mqtt-events.md](mqtt-events.md#vesperidstatusplayback). Published on transition, not polled. Source of truth for what the board is doing (a `control/ack` SUCCESS only means "accepted"). |
|
||||
| `vesper/{device_id}/system/alerts` | Subsystem state changes (warnings/errors) | 1 | **Yes**, until cleared | `alerts` | Published on transition only (WARNING/CRITICAL/FAILED/CLEARED). Not consumed by phone app — webserver/fleet only. |
|
||||
| `vesper/{device_id}/system/info` | Discrete system events (e.g. `boot_report`) | 1 | **Yes** | `info` | Not consumed by phone app. Excludes errors (those go to `alerts`) and metrics (those go to `metrics`). |
|
||||
| `vesper/{device_id}/system/logs` | Full log stream, serial-log equivalent | 0 | No | `logs` | Not consumed by phone app. Respects device's configured log level (`log.set_mqtt`) **and** this on/off switch independently — the switch can silence the whole channel without touching the configured level. Should not compete with heap/buffer needed for command traffic — guard same as `hasHeapForPublish()`. |
|
||||
|
||||
Reference in New Issue
Block a user