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>
This commit is contained in:
@@ -0,0 +1,828 @@
|
||||
# 🔔 VESPER ESP32 Communication API Reference v3.0
|
||||
|
||||
> **Complete command reference for Vesper Bell Automation System with Grouped Commands**
|
||||
> Version: 3.0 | Updated: 2025-09-15
|
||||
> Supports: MQTT + WebSocket protocols with multi-client support and batch processing
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Getting Started
|
||||
|
||||
### Connection Protocols
|
||||
- **MQTT**: `vesper/{device_id}/control` (commands) → `vesper/{device_id}/data` (responses)
|
||||
- **WebSocket**: `ws://{esp_ip}/ws` (bidirectional)
|
||||
- **UDP Discovery**: Broadcast on configured port for device discovery
|
||||
- **UDP Port**: 32101
|
||||
|
||||
### WebSocket Client Identification
|
||||
**Required for WebSocket clients to receive targeted messages:**
|
||||
|
||||
```json
|
||||
{
|
||||
"cmd": "system",
|
||||
"contents": {
|
||||
"action": "identify",
|
||||
"device_type": "master" // or "secondary"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"status": "SUCCESS",
|
||||
"type": "identify",
|
||||
"payload": "Device identified as master"
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📋 Command Categories (NEW GROUPED ARCHITECTURE)
|
||||
|
||||
- [🖥️ System Commands](#️-system-commands)
|
||||
- [🎵 Playback Control](#-playback-control)
|
||||
- [📁 File Management](#-file-management)
|
||||
- [🔧 Relay Setup](#-relay-setup)
|
||||
- [🕐 Clock Setup](#-clock-setup)
|
||||
- [📢 Information Messages](#-information-messages)
|
||||
- [🌐 Network & Discovery](#-network--discovery)
|
||||
- [🔄 Legacy Command Support](#-legacy-command-support)
|
||||
|
||||
---
|
||||
|
||||
## 🖥️ System Commands
|
||||
|
||||
### 🏓 Ping Test
|
||||
|
||||
**Command:**
|
||||
```json
|
||||
{
|
||||
"cmd": "system",
|
||||
"contents": {
|
||||
"action": "ping"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"status": "SUCCESS",
|
||||
"type": "pong",
|
||||
"payload": ""
|
||||
}
|
||||
```
|
||||
|
||||
### 📊 System Status
|
||||
|
||||
**Command:**
|
||||
```json
|
||||
{
|
||||
"cmd": "system",
|
||||
"contents": {
|
||||
"action": "status"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"status": "SUCCESS",
|
||||
"type": "current_status",
|
||||
"payload": {
|
||||
"player_status": "playing",
|
||||
"time_elapsed": 45230,
|
||||
"projected_run_time": 34598,
|
||||
"timestamp": 1699123456789
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 👤 Device Identification (WebSocket Only)
|
||||
|
||||
**Command:**
|
||||
```json
|
||||
{
|
||||
"cmd": "system",
|
||||
"contents": {
|
||||
"action": "identify",
|
||||
"device_type": "master"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 🔄 Restart Device
|
||||
|
||||
**Command:**
|
||||
```json
|
||||
{
|
||||
"cmd": "system",
|
||||
"contents": {
|
||||
"action": "restart"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"status": "SUCCESS",
|
||||
"type": "restart",
|
||||
"payload": "Device will restart in 2 seconds"
|
||||
}
|
||||
```
|
||||
|
||||
**Note:** Device will reboot after sending the response.
|
||||
|
||||
### 🔄 Force OTA Update
|
||||
|
||||
**Command:**
|
||||
```json
|
||||
{
|
||||
"cmd": "system",
|
||||
"contents": {
|
||||
"action": "force_update",
|
||||
"channel": "stable" // optional: "stable", "beta", or "emergency" (default: "stable")
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"status": "SUCCESS",
|
||||
"type": "force_update",
|
||||
"payload": "Starting forced OTA update from channel: stable. Device may reboot."
|
||||
}
|
||||
```
|
||||
|
||||
**Error Response (if player is active):**
|
||||
```json
|
||||
{
|
||||
"status": "ERROR",
|
||||
"type": "force_update",
|
||||
"payload": "Cannot update while playback is active"
|
||||
}
|
||||
```
|
||||
|
||||
**Note:** If update is successful, device will reboot automatically.
|
||||
|
||||
### 🔥 Custom Firmware Update
|
||||
|
||||
**Command:**
|
||||
```json
|
||||
{
|
||||
"cmd": "system",
|
||||
"contents": {
|
||||
"action": "custom_update",
|
||||
"firmware_url": "https://example.com/path/to/firmware.bin",
|
||||
"checksum": "a1b2c3d4e5f6...", // optional: SHA256 checksum for verification
|
||||
"file_size": 1234567, // optional: expected file size in bytes
|
||||
"version": 145 // optional: firmware version number to save in NVS
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"status": "SUCCESS",
|
||||
"type": "custom_update",
|
||||
"payload": "Starting custom OTA update. Device may reboot."
|
||||
}
|
||||
```
|
||||
|
||||
**Error Responses:**
|
||||
```json
|
||||
{
|
||||
"status": "ERROR",
|
||||
"type": "custom_update",
|
||||
"payload": "Missing firmware_url parameter"
|
||||
}
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "ERROR",
|
||||
"type": "custom_update",
|
||||
"payload": "Cannot update while playback is active"
|
||||
}
|
||||
```
|
||||
|
||||
**Features:**
|
||||
- Download firmware from any URL (bypasses configured update servers)
|
||||
- Optional SHA256 checksum verification
|
||||
- Optional file size validation
|
||||
- Optional version number to update NVS (prevents unwanted auto-downgrades)
|
||||
- Automatically blocks updates during playback
|
||||
- Device reboots on successful installation
|
||||
|
||||
**Version Parameter Behavior:**
|
||||
- If `version` is provided (> 0): NVS firmware version will be updated to this value
|
||||
- If `version` is omitted or 0: NVS firmware version remains unchanged
|
||||
- **Important:** Without version parameter, future OTA checks may detect your custom firmware as "outdated" and trigger auto-updates/downgrades
|
||||
|
||||
**Note:** If update is successful, device will reboot automatically. Use with caution!
|
||||
|
||||
---
|
||||
|
||||
## 🎵 Playback Control
|
||||
|
||||
### ▶️ Start Playback
|
||||
|
||||
**Command:**
|
||||
```json
|
||||
{
|
||||
"cmd": "playback",
|
||||
"contents": {
|
||||
"action": "play",
|
||||
"name": "My Melody",
|
||||
"uid": "01DegzV9FA8tYbQpkIHR",
|
||||
"url": "https://example.com/melody.bin",
|
||||
"speed": 500,
|
||||
"note_assignments": [1, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
"segment_duration": 15000,
|
||||
"pause_duration": 5000,
|
||||
"total_duration": 60000,
|
||||
"continuous_loop": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### ⏹️ Stop Playback
|
||||
|
||||
**Command:**
|
||||
```json
|
||||
{
|
||||
"cmd": "playback",
|
||||
"contents": {
|
||||
"action": "stop"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📁 File Management
|
||||
|
||||
### 📋 List Available Melodies
|
||||
|
||||
**Command:**
|
||||
```json
|
||||
{
|
||||
"cmd": "file_manager",
|
||||
"contents": {
|
||||
"action": "list_melodies"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Success Response:**
|
||||
```json
|
||||
{
|
||||
"status": "SUCCESS",
|
||||
"type": "list_melodies",
|
||||
"payload": ["melody1.bin", "melody2.bin", "melody3.bin"]
|
||||
}
|
||||
```
|
||||
|
||||
### 📥 Download Melody
|
||||
|
||||
**Command:**
|
||||
```json
|
||||
{
|
||||
"cmd": "file_manager",
|
||||
"contents": {
|
||||
"action": "download_melody",
|
||||
"download_url": "https://example.com/melody.bin",
|
||||
"melodys_uid": "01DegzV9FA8tYbQpkIHR",
|
||||
"name": "Optional Display Name"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 🗑️ Delete Melody
|
||||
|
||||
**Command:**
|
||||
```json
|
||||
{
|
||||
"cmd": "file_manager",
|
||||
"contents": {
|
||||
"action": "delete_melody",
|
||||
"name": "01DegzV9FA8tYbQpkIHR"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Relay Setup
|
||||
|
||||
### ⏱️ Set Relay Timers (Single Bell)
|
||||
|
||||
**Command:**
|
||||
```json
|
||||
{
|
||||
"cmd": "relay_setup",
|
||||
"contents": {
|
||||
"action": "set_timers",
|
||||
"b1": 100,
|
||||
"b2": 200,
|
||||
"b3": 150
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### ⏱️ Set Relay Timers (Batch Mode)
|
||||
|
||||
**Command:**
|
||||
```json
|
||||
{
|
||||
"cmd": "relay_setup",
|
||||
"contents": {
|
||||
"action": "set_timers",
|
||||
"timers": {
|
||||
"b1": 100,
|
||||
"b2": 200,
|
||||
"b3": 150,
|
||||
"b4": 300,
|
||||
"b5": 250,
|
||||
"b6": 180
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 🔌 Set Relay Outputs (Single Bell)
|
||||
|
||||
**Command:**
|
||||
```json
|
||||
{
|
||||
"cmd": "relay_setup",
|
||||
"contents": {
|
||||
"action": "set_outputs",
|
||||
"b1": 1,
|
||||
"b2": 2,
|
||||
"b3": 3
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 🔌 Set Relay Outputs (Batch Mode)
|
||||
|
||||
**Command:**
|
||||
```json
|
||||
{
|
||||
"cmd": "relay_setup",
|
||||
"contents": {
|
||||
"action": "set_outputs",
|
||||
"outputs": {
|
||||
"b1": 1,
|
||||
"b2": 2,
|
||||
"b3": 3,
|
||||
"b4": 4,
|
||||
"b5": 5,
|
||||
"b6": 6
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🕐 Clock Setup
|
||||
|
||||
### 🔌 Set Clock Outputs
|
||||
|
||||
**Command:**
|
||||
```json
|
||||
{
|
||||
"cmd": "clock_setup",
|
||||
"contents": {
|
||||
"action": "set_outputs",
|
||||
"c1": 1,
|
||||
"c2": 2
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### ⏰ Set Clock Timings
|
||||
|
||||
**Command:**
|
||||
```json
|
||||
{
|
||||
"cmd": "clock_setup",
|
||||
"contents": {
|
||||
"action": "set_timings",
|
||||
"pulseDuration": 5000,
|
||||
"pauseDuration": 2000
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 🔔 Set Clock Alerts
|
||||
|
||||
**Command:**
|
||||
```json
|
||||
{
|
||||
"cmd": "clock_setup",
|
||||
"contents": {
|
||||
"action": "set_alerts",
|
||||
"alertType": "HOURS",
|
||||
"alertRingInterval": 1000,
|
||||
"hourBell": 1,
|
||||
"halfBell": 2,
|
||||
"quarterBell": 3
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 💡 Set Clock Backlight
|
||||
|
||||
**Command:**
|
||||
```json
|
||||
{
|
||||
"cmd": "clock_setup",
|
||||
"contents": {
|
||||
"action": "set_backlight",
|
||||
"enabled": true,
|
||||
"output": 5,
|
||||
"onTime": "18:00",
|
||||
"offTime": "06:00"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 🔇 Set Clock Silence Periods
|
||||
|
||||
**Command:**
|
||||
```json
|
||||
{
|
||||
"cmd": "clock_setup",
|
||||
"contents": {
|
||||
"action": "set_silence",
|
||||
"daytime": {
|
||||
"enabled": true,
|
||||
"onTime": "13:00",
|
||||
"offTime": "15:00"
|
||||
},
|
||||
"nighttime": {
|
||||
"enabled": true,
|
||||
"onTime": "22:00",
|
||||
"offTime": "07:00"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 🚀 Batch Clock Setup (Multiple Settings at Once)
|
||||
|
||||
**Command:**
|
||||
```json
|
||||
{
|
||||
"cmd": "clock_setup",
|
||||
"contents": {
|
||||
"action": "batch_setup",
|
||||
"outputs": {
|
||||
"c1": 1,
|
||||
"c2": 2
|
||||
},
|
||||
"timings": {
|
||||
"pulseDuration": 5000,
|
||||
"pauseDuration": 2000
|
||||
},
|
||||
"alerts": {
|
||||
"alertType": "HOURS",
|
||||
"hourBell": 1,
|
||||
"halfBell": 2
|
||||
},
|
||||
"backlight": {
|
||||
"enabled": true,
|
||||
"output": 5,
|
||||
"onTime": "18:00",
|
||||
"offTime": "06:00"
|
||||
},
|
||||
"silence": {
|
||||
"daytime": {
|
||||
"enabled": true,
|
||||
"onTime": "13:00",
|
||||
"offTime": "15:00"
|
||||
},
|
||||
"nighttime": {
|
||||
"enabled": true,
|
||||
"onTime": "22:00",
|
||||
"offTime": "07:00"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Success Response:**
|
||||
```json
|
||||
{
|
||||
"status": "SUCCESS",
|
||||
"type": "clock_setup",
|
||||
"payload": "Batch clock setup updated: 5 sections"
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📢 Information Messages
|
||||
|
||||
> **Automatic status broadcasts sent to ALL clients**
|
||||
> These messages are initiated by the ESP32 system and broadcast to all connected clients without being requested.
|
||||
|
||||
### 🎵 Playback Status Updates
|
||||
|
||||
**Sent automatically during playback state changes:**
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "INFO",
|
||||
"type": "playback",
|
||||
"payload": {
|
||||
"action": "playing",
|
||||
"time_elapsed": 125,
|
||||
"projected_run_time": 5158
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### ⚠️ Bell Overload Warnings
|
||||
|
||||
**Sent automatically when bell load monitoring detects issues:**
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "INFO",
|
||||
"type": "bell_overload",
|
||||
"payload": {
|
||||
"bells": [1, 3, 5],
|
||||
"loads": [85, 92, 78],
|
||||
"severity": "warning"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🌐 Network & Discovery
|
||||
|
||||
### 🔍 UDP Discovery
|
||||
|
||||
**UDP Broadcast Request:**
|
||||
```json
|
||||
{
|
||||
"op": "discover",
|
||||
"svc": "vesper"
|
||||
}
|
||||
```
|
||||
|
||||
**UDP Response:**
|
||||
```json
|
||||
{
|
||||
"op": "discover_reply",
|
||||
"svc": "vesper",
|
||||
"ver": 1,
|
||||
"name": "Proj. Vesper v0.5",
|
||||
"id": "ESP32_ABC123",
|
||||
"ip": "192.168.1.100",
|
||||
"ws": "ws://192.168.1.100/ws",
|
||||
"port": 80,
|
||||
"fw": "1.2.3",
|
||||
"clients": 2
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Legacy Command Support
|
||||
|
||||
**For backward compatibility, the following legacy commands are still supported:**
|
||||
|
||||
### Individual Commands (Legacy)
|
||||
- `cmd: "ping"` → Use `system` with `action: "ping"`
|
||||
- `cmd: "report_status"` → Use `system` with `action: "status"`
|
||||
- `cmd: "identify"` → Use `system` with `action: "identify"`
|
||||
- `cmd: "list_melodies"` → Use `file_manager` with `action: "list_melodies"`
|
||||
- `cmd: "download_melody"` → Use `file_manager` with `action: "download_melody"`
|
||||
- `cmd: "delete_melody"` → Use `file_manager` with `action: "delete_melody"`
|
||||
- `cmd: "set_relay_timers"` → Use `relay_setup` with `action: "set_timers"`
|
||||
- `cmd: "set_relay_outputs"` → Use `relay_setup` with `action: "set_outputs"`
|
||||
- `cmd: "set_clock_outputs"` → Use `clock_setup` with `action: "set_outputs"`
|
||||
- `cmd: "set_clock_timings"` → Use `clock_setup` with `action: "set_timings"`
|
||||
- `cmd: "set_clock_alerts"` → Use `clock_setup` with `action: "set_alerts"`
|
||||
- `cmd: "set_clock_backlight"` → Use `clock_setup` with `action: "set_backlight"`
|
||||
- `cmd: "set_clock_silence"` → Use `clock_setup` with `action: "set_silence"`
|
||||
|
||||
**Legacy commands will continue to work but are deprecated. Please migrate to the new grouped command structure for optimal performance and features.**
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Key Advantages of Grouped Commands
|
||||
|
||||
### 🚀 **Batch Processing**
|
||||
- Send multiple settings in a single command
|
||||
- Reduce network overhead and latency
|
||||
- Atomic operations ensure consistency
|
||||
|
||||
### 📊 **Better Organization**
|
||||
- Logical grouping of related commands
|
||||
- Cleaner API structure
|
||||
- Easier to understand and maintain
|
||||
|
||||
### ⚡ **Enhanced Performance**
|
||||
- Fewer round-trips for complex configurations
|
||||
- Optimized ESP32 processing
|
||||
- Improved user experience
|
||||
|
||||
### 🔄 **Backward Compatibility**
|
||||
- Legacy commands still supported
|
||||
- Gradual migration path
|
||||
- No breaking changes for existing implementations
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Integration Examples
|
||||
|
||||
### Dart/Flutter App Integration
|
||||
|
||||
```dart
|
||||
// New grouped command approach
|
||||
await ClockSetup.batchClockSetup(
|
||||
c1Output: 1,
|
||||
c2Output: 2,
|
||||
pulseDuration: 5000,
|
||||
pauseDuration: 2000,
|
||||
alertType: 'HOURS',
|
||||
hourBell: 1,
|
||||
backlightEnabled: true,
|
||||
backlightOutput: 5,
|
||||
);
|
||||
|
||||
// Batch relay setup
|
||||
await RelaySetup.setBatchRelayOutputs({
|
||||
1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6,
|
||||
});
|
||||
|
||||
// Individual settings still work
|
||||
await ClockSetup.setOddClockOutput(1);
|
||||
await ClockSetup.setEvenClockOutput(2);
|
||||
```
|
||||
|
||||
### JavaScript/WebSocket Integration
|
||||
|
||||
```javascript
|
||||
// Batch clock configuration
|
||||
const clockConfig = {
|
||||
cmd: "clock_setup",
|
||||
contents: {
|
||||
action: "batch_setup",
|
||||
outputs: { c1: 1, c2: 2 },
|
||||
timings: { pulseDuration: 5000, pauseDuration: 2000 },
|
||||
alerts: { alertType: "HOURS", hourBell: 1 },
|
||||
backlight: { enabled: true, output: 5 }
|
||||
}
|
||||
};
|
||||
|
||||
webSocket.send(JSON.stringify(clockConfig));
|
||||
|
||||
// Batch relay configuration
|
||||
const relayConfig = {
|
||||
cmd: "relay_setup",
|
||||
contents: {
|
||||
action: "set_outputs",
|
||||
outputs: {
|
||||
b1: 1, b2: 2, b3: 3, b4: 4, b5: 5, b6: 6
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
webSocket.send(JSON.stringify(relayConfig));
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚨 Error Handling
|
||||
|
||||
### Common Error Types
|
||||
|
||||
**Missing Action Parameter:**
|
||||
```json
|
||||
{
|
||||
"status": "ERROR",
|
||||
"type": "relay_setup",
|
||||
"payload": "Missing action parameter"
|
||||
}
|
||||
```
|
||||
|
||||
**Unknown Action:**
|
||||
```json
|
||||
{
|
||||
"status": "ERROR",
|
||||
"type": "clock_setup",
|
||||
"payload": "Unknown action: invalid_action"
|
||||
}
|
||||
```
|
||||
|
||||
**Batch Processing Errors:**
|
||||
```json
|
||||
{
|
||||
"status": "ERROR",
|
||||
"type": "relay_setup",
|
||||
"payload": "No valid relay timers found in batch"
|
||||
}
|
||||
```
|
||||
|
||||
**Success with Count:**
|
||||
```json
|
||||
{
|
||||
"status": "SUCCESS",
|
||||
"type": "relay_setup",
|
||||
"payload": "Batch relay outputs updated: 6 bells"
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📡 Message Routing
|
||||
|
||||
### Response Routing Rules
|
||||
|
||||
1. **Command Responses**: Sent only to the originating client/protocol
|
||||
- MQTT command → MQTT response
|
||||
- WebSocket client #3 → WebSocket client #3 only
|
||||
|
||||
2. **Status Broadcasts**: Sent to ALL connected clients
|
||||
- All WebSocket clients receive the message
|
||||
- MQTT subscribers receive the message
|
||||
- Used for system notifications and status updates
|
||||
|
||||
3. **Targeted Messages**: Based on device type
|
||||
- `broadcastToMasterClients()`: Only master devices
|
||||
- `broadcastToSecondaryClients()`: Only secondary devices
|
||||
- `broadcastToAllWebSocketClients()`: All WebSocket clients
|
||||
|
||||
---
|
||||
|
||||
## ⚡ Performance Optimizations
|
||||
|
||||
### Batch Command Benefits
|
||||
|
||||
**Before (Legacy - 6 separate commands):**
|
||||
```javascript
|
||||
// 6 separate network calls
|
||||
await setRelayOutput(1, 1);
|
||||
await setRelayOutput(2, 2);
|
||||
await setRelayOutput(3, 3);
|
||||
await setRelayOutput(4, 4);
|
||||
await setRelayOutput(5, 5);
|
||||
await setRelayOutput(6, 6);
|
||||
```
|
||||
|
||||
**After (Grouped - 1 batch command):**
|
||||
```javascript
|
||||
// 1 network call for all settings
|
||||
await setBatchRelayOutputs({
|
||||
1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6
|
||||
});
|
||||
```
|
||||
|
||||
### Performance Metrics
|
||||
- **Network Calls**: Reduced by up to 85%
|
||||
- **Configuration Time**: 3-5x faster
|
||||
- **ESP32 Processing**: More efficient batch updates
|
||||
- **Error Handling**: Atomic operations ensure consistency
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Quick Reference
|
||||
|
||||
### Command Groups
|
||||
| Group | Purpose | Batch Support |
|
||||
|-------|---------|---------------|
|
||||
| `system` | Device management, ping, status | No |
|
||||
| `playback` | Music playback control | No |
|
||||
| `file_manager` | Melody file operations | No |
|
||||
| `relay_setup` | Bell configuration | ✅ Yes |
|
||||
| `clock_setup` | Clock mechanism setup | ✅ Yes |
|
||||
|
||||
### Actions by Group
|
||||
|
||||
**System:** `ping`, `status`, `identify`, `restart`, `force_update`, `custom_update`
|
||||
|
||||
**Playback:** `play`, `stop`
|
||||
|
||||
**File Manager:** `list_melodies`, `download_melody`, `delete_melody`
|
||||
|
||||
**Relay Setup:** `set_timers`, `set_outputs`
|
||||
|
||||
**Clock Setup:** `set_outputs`, `set_timings`, `set_alerts`, `set_backlight`, `set_silence`, `batch_setup`
|
||||
|
||||
---
|
||||
|
||||
*Happy Bell Automation with Grouped Commands! 🔔*
|
||||
@@ -0,0 +1,872 @@
|
||||
# Vesper Firmware — API Reference (v2)
|
||||
|
||||
> Command reference for the Vesper Bell Automation System.
|
||||
> Firmware v2 command bus architecture — all transports, all handlers.
|
||||
> Last updated: 2026-03-01
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
### Message Envelope
|
||||
|
||||
Every command sent to Vesper uses this JSON envelope:
|
||||
|
||||
```json
|
||||
{
|
||||
"v": 2,
|
||||
"cmd": "namespace.command",
|
||||
"contents": { ... }
|
||||
}
|
||||
```
|
||||
|
||||
| Field | Type | Notes |
|
||||
|---|---|---|
|
||||
| `v` | int | Protocol version. `2` = current. Omit or set `1` for legacy (LegacyAdapter runs). |
|
||||
| `cmd` | string | `namespace.command` format (e.g. `relay.set_durations`). |
|
||||
| `contents` | object | Command payload. May be omitted if command takes no fields. |
|
||||
|
||||
### Response Envelope
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "SUCCESS" | "ERROR",
|
||||
"type": "command_name",
|
||||
"payload": { ... }
|
||||
}
|
||||
```
|
||||
|
||||
`payload` is command-specific. On error, `payload` typically contains a `"message"` string.
|
||||
|
||||
---
|
||||
|
||||
## Transports
|
||||
|
||||
| Transport | Address | Direction | Notes |
|
||||
|---|---|---|---|
|
||||
| MQTT | `vesper/{device_id}/control` | Inbound commands | Responses go to `vesper/{device_id}/data` |
|
||||
| MQTT | `vesper/{device_id}/data` | Outbound responses + events | Command replies and bell overload notifications |
|
||||
| MQTT | `vesper/{device_id}/status/heartbeat` | Outbound, retained, QoS 1 | Heartbeat every 30s; server updates last_seen |
|
||||
| MQTT | `vesper/{device_id}/status/alerts` | Outbound, QoS 1 | Subsystem state-change events (published on change only) |
|
||||
| MQTT | `vesper/{device_id}/status/info` | Outbound, QoS 0 | General device state events (playback, reboot reason, etc.) |
|
||||
| WebSocket | `ws://{device_ip}/ws` | Bidirectional | Requires `identify` on connect |
|
||||
| HTTP | `http://{device_ip}/...` | REST | Web console endpoints |
|
||||
| UART | Hardware serial | Bidirectional | Restricted — whitelist only (see below) |
|
||||
| UDP | Port 32101 | Discovery broadcast | Passive — device announces itself |
|
||||
|
||||
### UART Whitelist
|
||||
|
||||
Only the following commands are accepted over UART (LCD/button slave board). All others are silently dropped.
|
||||
|
||||
```
|
||||
ping
|
||||
playback
|
||||
clock.pause
|
||||
clock.resume
|
||||
system.get_time
|
||||
```
|
||||
|
||||
### WebSocket — Client Identification
|
||||
|
||||
WebSocket clients must send `identify` immediately after connecting, or they will not receive targeted responses:
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "identify", "contents": { "device_type": "master" } }
|
||||
```
|
||||
|
||||
`device_type`: `"master"` (app/console) or `"secondary"` (slave board).
|
||||
|
||||
---
|
||||
|
||||
## Command Reference
|
||||
|
||||
---
|
||||
|
||||
### `ping`
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Handler | SystemHandler |
|
||||
| Transports | All |
|
||||
| Contents | *(none)* |
|
||||
| Returns | `{ "status": "SUCCESS", "type": "pong" }` |
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "ping" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `identify`
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Handler | SystemHandler |
|
||||
| Transports | WebSocket only |
|
||||
| Contents | `device_type` (required) |
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "identify", "contents": { "device_type": "master" } }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `playback`
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Handler | PlaybackHandler |
|
||||
| Transports | All |
|
||||
| Contents | `action` (required) + melody fields |
|
||||
|
||||
`action` values: `"play"`, `"stop"`, `"pause"`, `"unpause"`
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "playback", "contents": { "action": "play", "melody_uid": "ABC123" } }
|
||||
{ "v": 2, "cmd": "playback", "contents": { "action": "stop" } }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Relay Namespace — `RelayHandler`
|
||||
|
||||
---
|
||||
|
||||
### `relay.set_durations`
|
||||
|
||||
Set strike duration (ms) for one or more bell channels. Partial updates accepted — omitted channels are unchanged.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Required | At least one bell entry |
|
||||
| Contents | `{ "bells": { "0": 95, "2": 110 } }` |
|
||||
|
||||
```json
|
||||
{
|
||||
"v": 2,
|
||||
"cmd": "relay.set_durations",
|
||||
"contents": { "bells": { "0": 95, "1": 100, "2": 110 } }
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `relay.set_outputs`
|
||||
|
||||
Map bell channels to physical relay outputs. Partial updates accepted.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Required | At least one bell entry |
|
||||
| Contents | `{ "bells": { "0": 2, "1": 3 } }` |
|
||||
|
||||
```json
|
||||
{
|
||||
"v": 2,
|
||||
"cmd": "relay.set_outputs",
|
||||
"contents": { "bells": { "0": 2, "1": 3, "2": 4 } }
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `relay.get_config`
|
||||
|
||||
Read current bell durations and output assignments.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Required | *(none)* |
|
||||
| Returns | `{ "durations": { "0": 95, ... }, "outputs": { "0": 2, ... } }` |
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "relay.get_config" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `relay.test_output`
|
||||
|
||||
Fire a specific relay for a caller-specified duration. Safety-gated: Player must be stopped.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Required | `output` (int), `duration_ms` (int) |
|
||||
| Notes | Both fields required — no defaults. Typical range: 85–140 ms. |
|
||||
|
||||
```json
|
||||
{
|
||||
"v": 2,
|
||||
"cmd": "relay.test_output",
|
||||
"contents": { "output": 2, "duration_ms": 95 }
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Clock Namespace — `ClockHandler`
|
||||
|
||||
---
|
||||
|
||||
### `clock.set_outputs`
|
||||
|
||||
Set which relay outputs the clock strikes use.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Required | At least one of `c1`, `c2` |
|
||||
| Contents | `{ "c1": 4, "c2": 5 }` — partial OK |
|
||||
|
||||
---
|
||||
|
||||
### `clock.set_timings`
|
||||
|
||||
Set clock strike timing configuration. Partial updates accepted.
|
||||
|
||||
---
|
||||
|
||||
### `clock.set_alerts`
|
||||
|
||||
Configure hourly/quarter alert behavior. Partial updates accepted.
|
||||
|
||||
---
|
||||
|
||||
### `clock.set_backlight`
|
||||
|
||||
Configure backlight behavior. Partial updates accepted.
|
||||
|
||||
---
|
||||
|
||||
### `clock.set_silence`
|
||||
|
||||
Configure silence period (quiet hours). Partial updates accepted.
|
||||
|
||||
---
|
||||
|
||||
### `clock.set_time`
|
||||
|
||||
Set the RTC time.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Required | `timestamp` (Unix epoch, int) |
|
||||
| Optional | `timezone_offset` (int, seconds), `dst_offset` (int, seconds) |
|
||||
|
||||
```json
|
||||
{
|
||||
"v": 2,
|
||||
"cmd": "clock.set_time",
|
||||
"contents": { "timestamp": 1740000000, "timezone_offset": 7200 }
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `clock.set_face`
|
||||
|
||||
Set the physical analog clock face position.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Required | `hour` (int), `minute` (int) |
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "clock.set_face", "contents": { "hour": 10, "minute": 10 } }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `clock.set_timezone`
|
||||
|
||||
Set timezone independently of RTC time.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Required | `gmt_offset_sec` (int) |
|
||||
| Optional | `dst_offset_sec` (int), `timezone_name` (string) |
|
||||
|
||||
```json
|
||||
{
|
||||
"v": 2,
|
||||
"cmd": "clock.set_timezone",
|
||||
"contents": { "gmt_offset_sec": 7200, "dst_offset_sec": 3600, "timezone_name": "Europe/Athens" }
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `clock.get_timezone`
|
||||
|
||||
Read current timezone settings.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Returns | `{ "gmt_offset_sec": 7200, "dst_offset_sec": 3600, "timezone_name": "..." }` |
|
||||
|
||||
---
|
||||
|
||||
### `clock.sync_ntp`
|
||||
|
||||
Force an immediate NTP time sync.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Required | *(none)* |
|
||||
|
||||
---
|
||||
|
||||
### `clock.enable` / `clock.disable`
|
||||
|
||||
Enable or disable clock strike output.
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "clock.enable" }
|
||||
{ "v": 2, "cmd": "clock.disable" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `clock.pause` / `clock.resume`
|
||||
|
||||
Pause or resume clock updates.
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "clock.pause" }
|
||||
{ "v": 2, "cmd": "clock.resume" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `clock.get_face`
|
||||
|
||||
Read current analog clock face position.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Returns | `{ "clock_hour", "clock_minute", "last_sync_time", "next_output_is_c1" }` |
|
||||
|
||||
---
|
||||
|
||||
### `clock.get_config`
|
||||
|
||||
Read full clock configuration (outputs, timings, alerts, backlight, silence, enabled state).
|
||||
|
||||
---
|
||||
|
||||
## System Namespace — `SystemHandler`
|
||||
|
||||
---
|
||||
|
||||
### `system.status`
|
||||
|
||||
Get current device status: player state, strike counters, projected run time.
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "system.status" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `system.get_time`
|
||||
|
||||
Get current RTC time.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Returns | `{ "local_timestamp", "utc_timestamp", "year", "month", "day", "hour", "minute", "second", "rtc_available" }` |
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "system.get_time" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `system.get_settings`
|
||||
|
||||
Get full ConfigManager JSON dump (all saved settings).
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "system.get_settings" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `system.get_device_info`
|
||||
|
||||
Get device identity and runtime stats.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Returns | `{ "uid", "hw_type", "hw_version", "fw_version", "uptime_ms", "free_heap", "min_free_heap" }` |
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "system.get_device_info" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `system.health`
|
||||
|
||||
Get full HealthMonitor report — all subsystem states, warnings, critical failures.
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "system.health" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `system.factory_reset`
|
||||
|
||||
Reset all settings to factory defaults.
|
||||
|
||||
> **Warning:** Non-reversible. All saved configuration is wiped.
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "system.factory_reset" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `system.restart`
|
||||
|
||||
Reboot the device. Response is sent before reboot (2s delay).
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "system.restart" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Firmware Namespace — `FirmwareHandler`
|
||||
|
||||
---
|
||||
|
||||
### `firmware.status`
|
||||
|
||||
Get firmware validation state.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Returns | `{ "validation_state", "version", "boot_count", "can_commit", "can_rollback" }` |
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "firmware.status" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `firmware.commit`
|
||||
|
||||
Commit the current firmware as permanent (marks OTA slot as valid).
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "firmware.commit" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `firmware.rollback`
|
||||
|
||||
Roll back to the previous firmware. Device reboots.
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "firmware.rollback" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## OTA Namespace — `FirmwareHandler`
|
||||
|
||||
---
|
||||
|
||||
### `ota.status`
|
||||
|
||||
Get OTA update status.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Returns | `{ "current_version", "available_version", "channel", "update_available", "last_check", "progress" }` |
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "ota.status" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `ota.check`
|
||||
|
||||
Check for available updates.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Optional | `channel` (string, default `"stable"`) |
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "ota.check", "contents": { "channel": "beta" } }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `ota.update`
|
||||
|
||||
Trigger OTA update from VPS. Device may reboot.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Optional | `channel` (string, default `"stable"`) |
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "ota.update", "contents": { "channel": "stable" } }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `ota.custom`
|
||||
|
||||
Flash firmware from a custom URL.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Required | `firmware_url` (string) |
|
||||
| Optional | `checksum` (string), `file_size` (int), `version` (string) |
|
||||
|
||||
```json
|
||||
{
|
||||
"v": 2,
|
||||
"cmd": "ota.custom",
|
||||
"contents": {
|
||||
"firmware_url": "http://example.com/firmware.bin",
|
||||
"checksum": "abc123",
|
||||
"version": "142"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Network Namespace — `NetworkHandler`
|
||||
|
||||
---
|
||||
|
||||
### `network.info`
|
||||
|
||||
Get IP/gateway/DNS.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Returns | `{ "ip", "gateway", "dns" }` |
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "network.info" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `network.status`
|
||||
|
||||
Get full connection state.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Returns | `{ "connected", "state", "type", "ip", "rssi", "ap_mode" }` |
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "network.status" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `network.set_config`
|
||||
|
||||
Update network configuration. Partial updates accepted. Returns `restart_required` flag.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Required | At least one field |
|
||||
| Optional | `hostname`, `useStaticIP`, `ip`, `gateway`, `subnet`, `dns1`, `dns2` |
|
||||
| Notes | Static IP requires `ip` + `gateway` + `subnet` together |
|
||||
|
||||
```json
|
||||
{
|
||||
"v": 2,
|
||||
"cmd": "network.set_config",
|
||||
"contents": { "hostname": "vesper-lab", "useStaticIP": false }
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Files Namespace — `FileHandler`
|
||||
|
||||
---
|
||||
|
||||
### `files.list`
|
||||
|
||||
List melody files on the SD card.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Returns | Array of SD card melody file objects |
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "files.list" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `files.list_builtin`
|
||||
|
||||
List all built-in melodies compiled into the firmware.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Returns | `[{ "name": "...", "uid": "..." }, ...]` |
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "files.list_builtin" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `files.download`
|
||||
|
||||
Download a melody from the server to the SD card.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Required | `melodys_uid` (string) |
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "files.download", "contents": { "melodys_uid": "ABC123" } }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `files.delete`
|
||||
|
||||
Delete a melody from the SD card.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Required | `name` (string) |
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "files.delete", "contents": { "name": "westminster.mel" } }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Log Namespace — `LoggingHandler`
|
||||
|
||||
Set log verbosity per output channel. Level 0 = off, 5 = verbose.
|
||||
|
||||
| Level | Meaning |
|
||||
|---|---|
|
||||
| 0 | None |
|
||||
| 1 | Error |
|
||||
| 2 | Warning |
|
||||
| 3 | Info |
|
||||
| 4 | Debug |
|
||||
| 5 | Verbose |
|
||||
|
||||
### `log.set_serial`
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "log.set_serial", "contents": { "level": 3 } }
|
||||
```
|
||||
|
||||
### `log.set_sd`
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "log.set_sd", "contents": { "level": 2 } }
|
||||
```
|
||||
|
||||
### `log.set_mqtt`
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "log.set_mqtt", "contents": { "level": 1 } }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## MQTT Namespace — `MQTTHandler`
|
||||
|
||||
### `mqtt.enable` / `mqtt.disable`
|
||||
|
||||
Enable or disable MQTT connectivity.
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "mqtt.enable" }
|
||||
{ "v": 2, "cmd": "mqtt.disable" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Telemetry Namespace — `TelemetryHandler`
|
||||
|
||||
---
|
||||
|
||||
### `telemetry.get_strikes`
|
||||
|
||||
Get strike counts per bell channel.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Returns | `{ "strikes": { "0": 1234, "1": 567, ... } }` |
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "telemetry.get_strikes" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `telemetry.reset_strikes`
|
||||
|
||||
Reset strike counters. Omit `bell` to reset all channels; include it to reset one.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Optional | `bell` (int) — channel index |
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "telemetry.reset_strikes" }
|
||||
{ "v": 2, "cmd": "telemetry.reset_strikes", "contents": { "bell": 2 } }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `telemetry.get_loads`
|
||||
|
||||
Get heat load per bell channel, cooling status, and overload flags.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Returns | `{ "loads": { "0": 42.5, ... }, "cooling_active": false, "overloaded": [2, 5] }` |
|
||||
|
||||
```json
|
||||
{ "v": 2, "cmd": "telemetry.get_loads" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## MQTT Events (Unsolicited)
|
||||
|
||||
These messages are published by the device without a request. See [mqtt-events.md](mqtt-events.md) for the full AsyncAPI-compatible reference.
|
||||
|
||||
| Topic | When | QoS | Retained | Format |
|
||||
|---|---|---|---|---|
|
||||
| `vesper/{id}/status/heartbeat` | Every 30s | 1 | yes | Heartbeat envelope |
|
||||
| `vesper/{id}/status/alerts` | On subsystem state change only | 1 | no | Alert envelope |
|
||||
| `vesper/{id}/status/info` | On device state change | 0 | no | Info envelope |
|
||||
| `vesper/{id}/data` | Any command response / bell overload | 0 | no | Standard response envelope |
|
||||
|
||||
### Heartbeat Payload
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "INFO",
|
||||
"type": "heartbeat",
|
||||
"payload": {
|
||||
"device_id": "PV-26B18-VS01R-X7KQA",
|
||||
"firmware_version": "142",
|
||||
"timestamp": "Uptime: 5h 23m 45s",
|
||||
"ip_address": "10.0.0.3",
|
||||
"gateway": "10.0.0.1",
|
||||
"uptime_ms": 19425000
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Subscribe to `vesper/+/status/heartbeat` to discover all online devices.
|
||||
|
||||
### Alert Payload (`vesper/{id}/status/alerts`)
|
||||
|
||||
Published only when a subsystem state changes. The server should store the active alert set per device and update the display in place rather than appending a log entry.
|
||||
|
||||
```json
|
||||
{ "subsystem": "FileManager", "state": "WARNING", "msg": "ConfigManager health check failed" }
|
||||
```
|
||||
|
||||
On recovery:
|
||||
```json
|
||||
{ "subsystem": "FileManager", "state": "CLEARED" }
|
||||
```
|
||||
|
||||
`state` values: `WARNING` | `CRITICAL` | `FAILED` | `CLEARED`
|
||||
|
||||
### Info Payload (`vesper/{id}/status/info`)
|
||||
|
||||
Published on significant device state changes. `type` identifies the event; `payload` is event-specific.
|
||||
|
||||
```json
|
||||
{ "type": "playback_started", "payload": { "melody_uid": "ABC123" } }
|
||||
{ "type": "playback_stopped", "payload": {} }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Legacy Compatibility (v1)
|
||||
|
||||
If a client sends `"v": 1` (or omits `v`), the `LegacyAdapter` translates the old `cmd` + `action` pair to a v2 command before dispatch. No code changes needed on the client side during transition.
|
||||
|
||||
| v1 `cmd` | v1 `action` | v2 `cmd` |
|
||||
|---|---|---|
|
||||
| `ping` | — | `ping` |
|
||||
| `identify` | — | `identify` |
|
||||
| `playback` | — | `playback` |
|
||||
| `file_manager` | `list_melodies` | `files.list` |
|
||||
| `file_manager` | `download_melody` | `files.download` |
|
||||
| `file_manager` | `delete_melody` | `files.delete` |
|
||||
| `relay_setup` | `set_timings` | `relay.set_durations` |
|
||||
| `relay_setup` | `set_outputs` | `relay.set_outputs` |
|
||||
| `clock_setup` | `set_outputs` | `clock.set_outputs` |
|
||||
| `clock_setup` | `set_timings` | `clock.set_timings` |
|
||||
| `clock_setup` | `set_alerts` | `clock.set_alerts` |
|
||||
| `clock_setup` | `set_backlight` | `clock.set_backlight` |
|
||||
| `clock_setup` | `set_silence` | `clock.set_silence` |
|
||||
| `clock_setup` | `set_rtc_time` | `clock.set_time` |
|
||||
| `clock_setup` | `set_physical_clock_time` | `clock.set_face` |
|
||||
| `clock_setup` | `pause_clock_updates` | `clock.pause` |
|
||||
| `clock_setup` | `resume_clock_updates` | `clock.resume` |
|
||||
| `clock_setup` | `set_enabled` + `enabled=true` | `clock.enable` |
|
||||
| `clock_setup` | `set_enabled` + `enabled=false` | `clock.disable` |
|
||||
| `system_info` | `report_status` | `system.status` |
|
||||
| `system_info` | `get_device_time` | `system.get_time` |
|
||||
| `system_info` | `get_clock_time` | `clock.get_face` |
|
||||
| `system_info` | `get_firmware_status` | `firmware.status` |
|
||||
| `system_info` | `network_info` | `network.info` |
|
||||
| `system_info` | `get_full_settings` | `system.get_settings` |
|
||||
| `system_info` | `sync_time_to_lcd` | `system.get_time` *(LCD now uses request/response)* |
|
||||
| `system` | `status` | `system.status` |
|
||||
| `system` | `reset_defaults` | `system.factory_reset` |
|
||||
| `system` | `commit_firmware` | `firmware.commit` |
|
||||
| `system` | `rollback_firmware` | `firmware.rollback` |
|
||||
| `system` | `get_firmware_status` | `firmware.status` |
|
||||
| `system` | `set_network_config` | `network.set_config` |
|
||||
| `system` | `set_serial_log_level` | `log.set_serial` |
|
||||
| `system` | `set_sd_log_level` | `log.set_sd` |
|
||||
| `system` | `set_mqtt_log_level` | `log.set_mqtt` |
|
||||
| `system` | `set_mqtt_enabled` + `enabled=true` | `mqtt.enable` |
|
||||
| `system` | `set_mqtt_enabled` + `enabled=false` | `mqtt.disable` |
|
||||
| `system` | `restart` | `system.restart` |
|
||||
| `system` | `reboot` | `system.restart` |
|
||||
| `system` | `force_update` | `ota.update` |
|
||||
| `system` | `custom_update` | `ota.custom` |
|
||||
|
||||
---
|
||||
|
||||
## Quick Reference
|
||||
|
||||
| Namespace | Commands |
|
||||
|---|---|
|
||||
| *(root)* | `ping`, `identify`, `playback` |
|
||||
| `relay` | `set_durations`, `set_outputs`, `get_config`, `test_output` |
|
||||
| `clock` | `set_outputs`, `set_timings`, `set_alerts`, `set_backlight`, `set_silence`, `set_time`, `set_face`, `set_timezone`, `get_timezone`, `sync_ntp`, `enable`, `disable`, `pause`, `resume`, `get_face`, `get_config` |
|
||||
| `system` | `status`, `get_time`, `get_settings`, `get_device_info`, `health`, `factory_reset`, `restart` |
|
||||
| `firmware` | `status`, `commit`, `rollback` |
|
||||
| `ota` | `status`, `check`, `update`, `custom` |
|
||||
| `network` | `info`, `status`, `set_config` |
|
||||
| `files` | `list`, `list_builtin`, `download`, `delete` |
|
||||
| `log` | `set_serial`, `set_sd`, `set_mqtt` |
|
||||
| `mqtt` | `enable`, `disable` |
|
||||
| `telemetry` | `get_strikes`, `reset_strikes`, `get_loads` |
|
||||
@@ -0,0 +1,178 @@
|
||||
# Firmware Variants — Project Vesper
|
||||
|
||||
> Reference for all PlatformIO build environments defined in `vesper/platformio.ini`.
|
||||
|
||||
---
|
||||
|
||||
## Active Environments
|
||||
|
||||
### `vesper-v1` — Vesper (VS)
|
||||
|
||||
| Property | Value |
|
||||
|---|---|
|
||||
| Board | Kincony KC868-A6 |
|
||||
| MCU | ESP32-D0WD-V3 (rev 3.1) |
|
||||
| PlatformIO board target | `esp32dev` |
|
||||
| Flash size | 4 MB |
|
||||
| Partition table | `min_spiffs.csv` |
|
||||
| Board type code | `VS` |
|
||||
| Board version | `01` |
|
||||
| PSRAM | No |
|
||||
| RF remote | No |
|
||||
| Onboard LCD | No |
|
||||
|
||||
**Partition layout (`min_spiffs.csv`):**
|
||||
|
||||
| Partition | Address | Size |
|
||||
|---|---|---|
|
||||
| nvs | `0x9000` | 20 KB (0x5000) |
|
||||
| app0 (active) | `0x10000` | ~1.8 MB |
|
||||
| app1 (OTA) | `0x1F0000` | ~1.8 MB |
|
||||
| spiffs | `0x3D0000` | 128 KB |
|
||||
|
||||
**Build:**
|
||||
```bash
|
||||
# From repo root
|
||||
pio run -e vesper-v1
|
||||
# Output: vesper/.pio/build/vesper-v1/firmware.bin
|
||||
```
|
||||
|
||||
**Full erase + upload:**
|
||||
```bash
|
||||
pio run -e vesper-v1 --target upload --upload-port COM8
|
||||
```
|
||||
|
||||
**Flash NVS after full upload** (NVS is wiped by full erase — must reflash separately):
|
||||
```bash
|
||||
C:/Users/espi_/.espressif/python_env/idf5.4_py3.11_env/Scripts/python.exe \
|
||||
-m esptool --chip esp32 --port COM8 --baud 921600 \
|
||||
write_flash 0x9000 vesper/provisioning/nvs_lab_device.bin
|
||||
```
|
||||
|
||||
**Serial monitor:**
|
||||
```bash
|
||||
pio device monitor # 115200 baud
|
||||
```
|
||||
|
||||
**OTA URL pattern (VPS NGINX):**
|
||||
```
|
||||
http://72.61.191.197/ota/vs/stable/firmware.bin
|
||||
http://72.61.191.197/ota/vs/{channel}/firmware.bin
|
||||
```
|
||||
Channels: `stable`, `beta`
|
||||
|
||||
**Key build flags:**
|
||||
```ini
|
||||
-DBOARD_TYPE="VS"
|
||||
-DBOARD_VERSION="01"
|
||||
-DBOARD_NAME="Vesper"
|
||||
-DPSRAM_ENABLED=0
|
||||
-DHAS_RF=0
|
||||
-DHAS_LCD=0
|
||||
-DMQTT_SECRET="<set-locally-not-committed>"
|
||||
```
|
||||
|
||||
> **Important:** `MQTT_SECRET` must match the `MQTT_SECRET` in the backend `.env` on the VPS.
|
||||
> Never commit the real secret. Override locally via a `platformio.ini.local` file (gitignored):
|
||||
> ```ini
|
||||
> [env:vesper-v1]
|
||||
> build_flags =
|
||||
> ... (copy existing flags) ...
|
||||
> -DMQTT_SECRET=\"your_actual_secret\"
|
||||
> ```
|
||||
|
||||
---
|
||||
|
||||
## Planned Environments (Not Yet Active)
|
||||
|
||||
### `vesper-plus-v1` — Vesper+ (VP)
|
||||
|
||||
| Property | Value |
|
||||
|---|---|
|
||||
| Board target | `esp32dev` |
|
||||
| Board type code | `VP` |
|
||||
| RF remote | **Yes** (`HAS_RF=1`) |
|
||||
| Onboard LCD | No |
|
||||
| Status | Commented out in `platformio.ini` |
|
||||
|
||||
**When activated, upload command:**
|
||||
```bash
|
||||
pio run -e vesper-plus-v1 --target upload --upload-port <PORT>
|
||||
```
|
||||
|
||||
**OTA URL pattern:**
|
||||
```
|
||||
http://72.61.191.197/ota/vp/stable/firmware.bin
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `vesper-pro-v1` — Vesper Pro (VX)
|
||||
|
||||
| Property | Value |
|
||||
|---|---|
|
||||
| Board target | `esp32dev` |
|
||||
| Board type code | `VX` |
|
||||
| RF remote | No |
|
||||
| Onboard LCD | **Yes** (`HAS_LCD=1`) |
|
||||
| Status | Commented out in `platformio.ini` |
|
||||
|
||||
**When activated, upload command:**
|
||||
```bash
|
||||
pio run -e vesper-pro-v1 --target upload --upload-port <PORT>
|
||||
```
|
||||
|
||||
**OTA URL pattern:**
|
||||
```
|
||||
http://72.61.191.197/ota/vx/stable/firmware.bin
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## NVS Identity (All Variants)
|
||||
|
||||
Each device has a pre-flashed NVS partition at `0x9000` containing:
|
||||
|
||||
| NVS namespace | Key | Example |
|
||||
|---|---|---|
|
||||
| `device_id` | `device_uid` | `PV-26B18-VS01R-X7KQA` |
|
||||
| `device_id` | `hw_type` | `VS` |
|
||||
| `device_id` | `hw_version` | `01` |
|
||||
|
||||
NVS binaries are generated by the admin console at:
|
||||
```
|
||||
GET /api/manufacturing/devices/{sn}/nvs.bin
|
||||
```
|
||||
|
||||
The lab device NVS CSV and binary live at:
|
||||
```
|
||||
vesper/provisioning/nvs_lab_device.csv
|
||||
vesper/provisioning/nvs_lab_device.bin
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Shared Library Dependencies
|
||||
|
||||
All variants share the same `lib_deps` (defined in `[common]`):
|
||||
|
||||
| Library | Purpose |
|
||||
|---|---|
|
||||
| `tzapu/WiFiManager` | WiFi provisioning captive portal |
|
||||
| `me-no-dev/ESPAsyncWebServer` | Async HTTP server + WebSocket |
|
||||
| `me-no-dev/AsyncTCP` | Async TCP (required by above) |
|
||||
| `bblanchon/ArduinoJson` | JSON parsing (v7) |
|
||||
| `adafruit/Adafruit PCF8574` | I2C GPIO expander (relay control) |
|
||||
| `adafruit/RTClib` | Real-time clock |
|
||||
| `marvinroger/async-mqtt-client` | Async MQTT client |
|
||||
|
||||
---
|
||||
|
||||
## Adding a New Variant
|
||||
|
||||
1. Copy a `[env:vesper-*]` block in `vesper/platformio.ini` and uncomment it.
|
||||
2. Set the correct `BOARD_TYPE`, `BOARD_VERSION`, `HAS_RF`, `HAS_LCD` flags.
|
||||
3. Add the new `BoardType` value to `backend/manufacturing/models.py` (`BoardType` enum and `BOARD_TYPE_LABELS`).
|
||||
4. Add the NVS gen path for the new `hw_type` in `backend/utils/nvs_generator.py` if needed.
|
||||
5. Create the NGINX OTA directory on the VPS: `/srv/ota/{new_type}/stable/`.
|
||||
6. Upload a firmware binary and update the firmware manager entry.
|
||||
@@ -0,0 +1,209 @@
|
||||
# Vesper — MQTT Events Reference
|
||||
|
||||
> Source of truth for all unsolicited MQTT messages published by Vesper firmware.
|
||||
> Use this document to generate or update the AsyncAPI specification in the backend console.
|
||||
> Last updated: 2026-03-01
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
Vesper publishes on four MQTT topics. All topics are device-scoped under the prefix `vesper/{device_id}/`.
|
||||
|
||||
| Topic | Direction | QoS | Retained | Purpose |
|
||||
|-------|-----------|-----|----------|---------|
|
||||
| `vesper/{id}/control` | Inbound | — | — | Commands from server/app |
|
||||
| `vesper/{id}/data` | Outbound | 0 | no | Command responses + bell overload events |
|
||||
| `vesper/{id}/status/heartbeat` | Outbound | 1 | yes | Periodic liveness signal |
|
||||
| `vesper/{id}/status/alerts` | Outbound | 1 | no | Subsystem state-change events |
|
||||
| `vesper/{id}/status/info` | Outbound | 0 | no | General device state events |
|
||||
|
||||
Subscribe to `vesper/+/status/#` to receive all status events from all devices.
|
||||
|
||||
---
|
||||
|
||||
## `vesper/{id}/status/heartbeat`
|
||||
|
||||
**QoS:** 1 — **Retained:** yes — **Interval:** 30 seconds
|
||||
|
||||
Published immediately on MQTT connect, then every 30 seconds. The broker retains the last message so any new subscriber instantly sees whether the device is alive.
|
||||
|
||||
The server should:
|
||||
- Update `last_seen` timestamp silently — **no log entry, no display update**
|
||||
- Raise an offline alert if no heartbeat is received within 90 seconds (3 missed beats)
|
||||
|
||||
### Payload
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "INFO",
|
||||
"type": "heartbeat",
|
||||
"payload": {
|
||||
"device_id": "PV-26B18-VS01R-X7KQA",
|
||||
"firmware_version": "154",
|
||||
"timestamp": "Uptime: 5h 23m 45s",
|
||||
"ip_address": "10.0.0.3",
|
||||
"gateway": "10.0.0.1",
|
||||
"uptime_ms": 19425000
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `payload.device_id` | string | Device serial number (from NVS) |
|
||||
| `payload.firmware_version` | string | Firmware build version string |
|
||||
| `payload.timestamp` | string | Human-readable uptime string |
|
||||
| `payload.ip_address` | string | Current device IP |
|
||||
| `payload.gateway` | string | Network gateway IP |
|
||||
| `payload.uptime_ms` | integer | Milliseconds since boot |
|
||||
|
||||
---
|
||||
|
||||
## `vesper/{id}/status/alerts`
|
||||
|
||||
**QoS:** 1 — **Retained:** no — **Trigger:** subsystem state change only
|
||||
|
||||
Published by `HealthMonitor` (via `CommunicationRouter::publishAlert()`) whenever a subsystem transitions between health states. Published once on change; not repeated until the state changes again. Silent if MQTT is not connected at the moment of the transition.
|
||||
|
||||
The server should:
|
||||
- Maintain a **per-device active alert set** (e.g. a dict keyed by `subsystem`)
|
||||
- On receipt: upsert the alert in the set
|
||||
- On `CLEARED`: remove the entry from the set
|
||||
- Display the active alert set statically on the device detail page — **not as a scrolling log**
|
||||
|
||||
### Alert payload (problem)
|
||||
|
||||
```json
|
||||
{
|
||||
"subsystem": "FileManager",
|
||||
"state": "WARNING",
|
||||
"msg": "ConfigManager health check failed"
|
||||
}
|
||||
```
|
||||
|
||||
### Cleared payload (recovery)
|
||||
|
||||
```json
|
||||
{
|
||||
"subsystem": "FileManager",
|
||||
"state": "CLEARED"
|
||||
}
|
||||
```
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `subsystem` | string | Subsystem name. One of: `BellEngine`, `OutputManager`, `Player`, `Communication`, `TimeKeeper`, `Telemetry`, `OTAManager`, `Networking`, `ConfigManager`, `FileManager` |
|
||||
| `state` | string | New state: `WARNING` \| `CRITICAL` \| `FAILED` \| `CLEARED` |
|
||||
| `msg` | string | Human-readable description. Absent when `state` is `CLEARED`. |
|
||||
|
||||
### State meanings
|
||||
|
||||
| State | Meaning |
|
||||
|-------|---------|
|
||||
| `WARNING` | Subsystem has an issue but device continues to operate |
|
||||
| `CRITICAL` | Subsystem failure affects core functionality |
|
||||
| `FAILED` | Subsystem is non-functional (equivalent to CRITICAL for critical subsystems) |
|
||||
| `CLEARED` | Subsystem has recovered; remove from active alert set |
|
||||
|
||||
### Critical vs non-critical subsystems
|
||||
|
||||
| Subsystem | Critical? | Notes |
|
||||
|-----------|-----------|-------|
|
||||
| BellEngine | yes | Core timing — CRITICAL triggers rollback consideration |
|
||||
| OutputManager | yes | Hardware — CRITICAL triggers rollback consideration |
|
||||
| Player | yes | Melody control |
|
||||
| ConfigManager | no | SD card absence maps to WARNING |
|
||||
| FileManager | no | SD card absence maps to WARNING |
|
||||
| Communication | no | MQTT/WS failure |
|
||||
| TimeKeeper | no | RTC sync failure |
|
||||
| Telemetry | no | Strike counting |
|
||||
| OTAManager | no | OTA update subsystem |
|
||||
| Networking | no | WiFi connectivity |
|
||||
|
||||
---
|
||||
|
||||
## `vesper/{id}/status/info`
|
||||
|
||||
**QoS:** 0 — **Retained:** no — **Trigger:** significant device state change
|
||||
|
||||
Published for general device state changes that are not health failures. Use this topic to update the device detail panel (e.g. current playback, reboot reason) without polling.
|
||||
|
||||
The server should display the most recent `info` payload for each event `type` on the device detail page.
|
||||
|
||||
### Envelope
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "event_type",
|
||||
"payload": { ... }
|
||||
}
|
||||
```
|
||||
|
||||
### Event types (current and planned)
|
||||
|
||||
| `type` | When | Payload fields |
|
||||
|--------|------|----------------|
|
||||
| `playback_started` | Player begins playing a melody | `melody_uid` (string) |
|
||||
| `playback_stopped` | Player stops | *(none)* |
|
||||
|
||||
> **Note:** `publishInfo()` exists in `CommunicationRouter` but is not yet called from any subsystem. Call sites will be added as feature work in subsequent firmware versions. The API is stable.
|
||||
|
||||
---
|
||||
|
||||
## `vesper/{id}/data`
|
||||
|
||||
**QoS:** 0 — **Retained:** no
|
||||
|
||||
Published in response to commands and for unsolicited events that are not health-related.
|
||||
|
||||
### Command response envelope
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "SUCCESS" | "ERROR",
|
||||
"type": "command_name",
|
||||
"payload": { ... }
|
||||
}
|
||||
```
|
||||
|
||||
### Bell overload event
|
||||
|
||||
Published by `CommunicationRouter::sendBellOverloadNotification()` when per-bell strike load exceeds configured thresholds.
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "INFO",
|
||||
"type": "bell_overload",
|
||||
"payload": {
|
||||
"bells": [2, 5],
|
||||
"loads": [54, 48],
|
||||
"severity": "WARNING"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `payload.bells` | array of int | 1-indexed bell channel numbers that are overloaded |
|
||||
| `payload.loads` | array of int | Strike count load per bell channel |
|
||||
| `payload.severity` | string | `WARNING` (≥60% load) or `CRITICAL` (≥90% load) |
|
||||
|
||||
---
|
||||
|
||||
## Server subscription pattern
|
||||
|
||||
```
|
||||
vesper/+/status/heartbeat → update last_seen, no logging
|
||||
vesper/+/status/alerts → upsert/remove active alert set per device
|
||||
vesper/+/status/info → update device state panel
|
||||
vesper/+/data → display command responses, handle bell_overload
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Removed events
|
||||
|
||||
| Event | Was published to | Removed in | Reason |
|
||||
|-------|-----------------|------------|--------|
|
||||
| `ding` (bell fired) | `vesper/{id}/data` (WebSocket only) | Firmware v155+ | Unstable under load; no active consumers |
|
||||
Reference in New Issue
Block a user