docs(api-reference): audit against real handlers — playback.play/stop, message/data envelope, ~30 missing commands
The API reference had drifted far from the firmware. Rewritten against the handlers' commands() lists, field parsing and CommandResult::err() strings: - Playback: document playback.play / playback.stop (the bare v2 cmd:"playback"+action form returns "Unknown command"; v1 form still works via LegacyAdapter, and is the only form UART's whitelist accepts). List the fields Player::setMelodyAttributes() actually parses (url, not download_url), how mode/duration interact, the legacy segment_duration/total_duration path, sticky fields, and reply type "playback". - Response envelope: message (string) + data (object), status INFO only on WS broadcasts, no "payload" key; req_id is MQTT-only; v defaults per transport; type exceptions (pong/playback/unknown/parse_error/bad_request). - Add missing commands: relay.set_config/test_bell/test_batch, clock.set_config/set_alerts_config/test_c1/test_c2, system.get_config/ get_all/get_telemetry, ota.set_channel, log.get_config, logs.clear, all telemetry.* and bells.*. Remove nonexistent ota.status/ota.check. - Fix wrong fields: clock.set_alerts is camelCase, clock.set_silence is nested, clock.set_time offsets need both fields, clock.set_timezone has no timezone_name, files.download needs download_url, ota.update defaults to "stable", RF play-slot fields are required (duration 0 rejected), fix legacy map to match LegacyAdapter. - mqtt-events.md: fix the control/command example; note nothing calls CommandBus::broadcast(). Topic spec: req_id is MQTT-only today. Doc-only — no catalog entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -285,16 +285,18 @@ Structured telemetry for fleet-health graphing — not consumed by the phone app
|
||||
### Command (inbound)
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "playback", "req_id": "abc123", "contents": { "action": "stop" } }
|
||||
{ "v": 2, "cmd": "playback.stop", "req_id": "abc123" }
|
||||
```
|
||||
|
||||
### Reply (outbound)
|
||||
|
||||
```json
|
||||
{ "status": "SUCCESS", "type": "playback", "req_id": "abc123", "message": "Command executed" }
|
||||
{ "status": "SUCCESS", "type": "playback", "req_id": "abc123", "message": "Playback command executed" }
|
||||
```
|
||||
|
||||
`req_id` only appears in the reply if the request included one. Bus-wide unsolicited broadcasts (`CommandBus::broadcast()`) also publish here, with the same envelope shape and no `req_id` — but purpose-specific events (playback, alerts, reports, metrics) never use this path; they publish directly to their own topics instead.
|
||||
Reply envelope: `status` (`SUCCESS`/`ERROR`), `type`, optional `req_id`, and either `message` (string — text replies and every error) or `data` (object — structured replies). There is no `payload` key. `req_id` only appears in the reply if the request included one. See [api-reference.md](api-reference.md#response-envelope) for the full envelope rules.
|
||||
|
||||
`CommandBus::broadcast()` would also publish here (same envelope, `status: "INFO"`, no `req_id`), but nothing in the firmware calls it today — purpose-specific events (playback, alerts, reports, metrics) publish directly to their own topics.
|
||||
|
||||
### Malformed input
|
||||
|
||||
|
||||
Reference in New Issue
Block a user