No fielded Vesper Standard unit has an RF receiver, but vesper-std.hpp set
HAS_RF 1, so every build ran the RF task on GPIO 22 and exposed rf.*
commands that could never do anything. Set HAS_RF 0 (RF_RX_PIN kept for a
future RF revision). rf.* now return "Unknown command" on this build; agnus
keeps RF. Docs updated to say rf.* is agnus-only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Verified: MQTTTransport reads req_id into the envelope, CommandBus::dispatch()
runs the handler and calls reply() synchronously on the same task, and
Player::command() returns immediately in every case — the download path only
signals MelodyDL and never defers the ACK. So req_id is echoed on every
playback.play/stop ACK, including v1 "playback" translated by LegacyAdapter.
Documents the invariant in CommandBus::dispatch() and the topic spec, plus
the cases where no reply is sent at all (heap guard, command switch off,
broker down). No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A play that needed a download was ACKed SUCCESS and then nothing was
visible until playback started — and a failed download was only logged.
- New PlayerStatus::LOADING: status/playback publishes action "loading"
(pid/speed/duration/source set) before the ACK, then "playing" on success
or "idle" on failure.
- On failure after the ACK, control/reports gets
{ "type": "playback_failed", "payload": { "pid", "reason" } } (and a WS
INFO of the same). The download task re-checks bells-disabled/overload
before playing.
- playback.stop / forceStop during LOADING cancels the pending start
("Download cancelled — playback will not start"); the transfer finishes
and is discarded. New plays are refused until it does, since the task
still owns pid/_melodySteps. A mutex serialises the task's cancel-check +
play() against the cancel path.
- "loading" is MQTT-only: v1 tablets map unknown WS playback actions to
"unavailable" (F-061 symptom). system.status reports LOADING; the v1
adapter maps it to "idle".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every rejection used to reach the caller as "Playback command failed".
Player::command() now returns PlayerCommandResult { ok, message } and
PlaybackHandler forwards the message verbatim:
- busy, missing pid, invalid speed / note_assignments / durations / mode,
timed|interval without duration, bells disabled, bell overload lockout,
melody failed to load (incl. 0-byte file), not found without url,
needs download but no SD card
- success: "Playback started", "Melody download started — …",
"Playback stopped", and "Already stopped" (stop while idle stays SUCCESS —
idempotent, goal state reached)
Validation runs before setMelodyAttributes(), so a rejected play no longer
half-applies its fields. Also fixes: url was sticky (a later play of another
pid could download the old URL under the new name); bells.disable let a play
"succeed" and report playing with silent bells; a non-string name/pid
assigned nullptr to std::string.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
status/playback is retained but was only published on a Player transition.
After a power loss mid-melody the Player boots straight into STOPPED with no
transition, so the broker kept serving the old "playing" forever. The
MQTT on-connect callback now publishes Player::getPlaybackSnapshot() on
every CONNECT (not just the first after boot) — "idle" after a reboot, the
live state after a plain reconnect.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
The remote phone app treats status/playback as the source of truth for what
the board is doing, but the payload couldn't say what was playing, and a
client receiving a stale retained message couldn't work out real elapsed
time. Adds (old fields kept):
- pid, speed, duration (effective stop timer after mode/legacy resolution)
- started_at / ts — Unix epoch s (UTC); system clock once NTP-synced, else
new Timekeeper::getUtcEpoch() (RTC local time minus configured offsets),
else 0
- source — app | rf | button | schedule | unknown. Carried, not guessed:
new CommandEnvelope::origin set by each transport (MQTT/WS/HTTP → APP,
UART slave board → BUTTON), mapped by PlaybackHandler; RFRemote passes RF
New PlaybackState.hpp has one PlaybackSnapshot::writeTo() used for both the
WebSocket INFO broadcast (under "payload") and MQTT status/playback (flat),
so local and remote clients match. publishPlayback() now honours the
hasHeapForPublish() guard before building the document.
Bumps FW_VERSION to 2.3.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
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>
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>
Standalone Arduino test sketches for IS31FL3193 LED driver and PCF8575/PCF8574
relay bring-up (not part of the PlatformIO build), a known-issues note, and
two Dart files from the tablet app kept as reference for the comms protocol.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Device identity (serial/hw_family/hw_revision) has been read-only from
production firmware since NVS provisioning — serial derives the MQTT
password and hw_family/hw_revision select the OTA channel, so an
uncontrolled write path could desync MQTT auth or brick OTA to the
wrong hardware. This adds one narrow, deliberate exception: an
MQTT-only system.set_identity command for correcting a
mis-provisioned unit or reassigning a serial after a board swap,
without a USB/serial reflash.
Rejected over WebSocket/HTTP/UART by design (same pattern as
identify's WebSocket-only check); requires all three fields together
to avoid partial-identity states; forces a reboot after a successful
write since MQTT credentials/hostname/AP SSID are derived from serial
only once at boot. Firmware does not update the backend device record
itself — that's the caller's (console's) responsibility in the same
operation.
Also includes docs/README.md's rule 6 (console API reference sync
requirement) from an earlier uncommitted session, which this change
follows.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Startup retry count, runtime failure count, and backup partition info were
tracked internally (NVS-persisted) but only visible via LOG_* output — not
queryable remotely. Added getStartupRetryCount()/getRuntimeFailureCount()
getters and extended firmware.status with startup_retry_count,
max_startup_retries, runtime_failure_count, max_runtime_failures,
backup_version, backup_is_valid.
F-049 in the feature catalog. Also finalizes the feature-catalog.md and
api-reference.md updates for F-045/F-046/F-047/F-048 from the two prior
commits (doc content is consolidated into this final commit rather than
split across the changeset).
WiFi signal strength (dBm) now included in every heartbeat message.
Docs updated: MQTTDriver README, api-reference, heartbeat feature doc.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- 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>