Commit Graph
4 Commits
Author SHA1 Message Date
bonaminandClaude Opus 5.5 b80dbc9b89 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>
2026-09-29 20:02:58 +03:00
bonaminandClaude Sonnet 5 4ea581af5b fix(MQTTTransport): reply with error instead of silently dropping malformed input (F-063)
Invalid JSON or a missing 'cmd' field on control/command previously logged
a WARNING on serial and returned with no reply at all — a client waiting
on control/ack had no way to tell "malformed request" apart from "message
never arrived" or "device offline," all three looking identical until its
own timeout fired.

Both onMessage() drop paths now publish an ERROR to control/ack before
returning: { "status": "ERROR", "type": "parse_error", "message": "..." }.
Unparseable JSON necessarily has no req_id (nothing to read it from); a
valid-but-cmd-less message echoes req_id if one was present. The heap-guard
drop above these two (hasHeapForPublish() check) is untouched — that one's
silence is deliberate, protecting against allocation under critical heap
pressure (see F-055), not something this fix should touch.

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

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-21 18:06:26 +03:00
bonaminandClaude Sonnet 5 391ecb63fc 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>
2026-09-21 10:48:36 +03:00
bonaminandClaude Sonnet 4.6 d4bd990e53 feat: semver versioning, FastAPI OTA integration, health alerts via MQTT
- Version.hpp: extract FW_VERSION from main.cpp into shared header
- OTAManager: replace uint16_t version with SemVer struct; update API URLs
  to new FastAPI backend (/api/firmware/{hw_type}/{channel}/latest);
  add postDownloadTelemetry() and postFlashTelemetry() for fleet visibility
- ConfigManager: remove fwVersion from DeviceConfig (always read from
  FW_VERSION constant); saveDeviceConfig/loadDeviceConfig are now no-ops;
  fallbackServerUrl replaced with fallbackServerUrls[2] array
- HealthMonitor: add AlertCallback + setAlertCallback() firing on state
  transitions (including CLEARED on recovery)
- CommunicationRouter: wire HealthMonitor alert callback on begin();
  add publishAlert() and publishInfo() for MQTT status topics
- MQTTDriver: add _alertsTopic + _infoTopic; add publishDirect() for
  absolute topic publishing; migrate heartbeat to JsonDocument
- ResponseBuilder, ClientManager, BellEngine: StaticJsonDocument /
  DynamicJsonDocument → JsonDocument; remove dead notifyBellsFired()
- docs: reorganise into architecture/, dev/, features/, reference/

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 22:15:27 +02:00