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>
26 lines
689 B
C++
26 lines
689 B
C++
#pragma once
|
|
|
|
#include <vector>
|
|
#include "../ICommandHandler.hpp"
|
|
|
|
class ConfigManager;
|
|
|
|
// Forward declare the driver to avoid pulling in full MQTTDriver header.
|
|
class MQTTDriver;
|
|
|
|
class MQTTHandler : public ICommandHandler {
|
|
public:
|
|
MQTTHandler(ConfigManager& configManager, MQTTDriver& mqttClient);
|
|
|
|
std::vector<String> commands() const override;
|
|
CommandResult execute(const CommandEnvelope& envelope) override;
|
|
|
|
private:
|
|
ConfigManager& _configManager;
|
|
MQTTDriver& _mqttClient;
|
|
|
|
CommandResult handleGetConfig(const CommandEnvelope& e);
|
|
CommandResult handleGetTopics(const CommandEnvelope& e);
|
|
CommandResult handleSetTopics(const CommandEnvelope& e);
|
|
};
|