feat(heartbeat): add rssi to heartbeat payload

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>
This commit is contained in:
2026-07-13 02:10:41 +03:00
co-authored by Claude Sonnet 4.6
parent 3582218b54
commit 399b4d056c
4 changed files with 9 additions and 13 deletions
+2 -10
View File
@@ -22,7 +22,8 @@ vesper/{deviceID}/status/heartbeat
"timestamp": "Uptime: 5h 23m 45s", "timestamp": "Uptime: 5h 23m 45s",
"ip_address": "192.168.1.100", "ip_address": "192.168.1.100",
"gateway": "192.168.1.1", "gateway": "192.168.1.1",
"uptime_ms": 19425000 "uptime_ms": 19425000,
"rssi": -62
} }
} }
``` ```
@@ -101,19 +102,10 @@ void heartbeatTimerCallback(); // Timer callback handler
### Possible Additions: ### Possible Additions:
- Add actual RTC timestamp (instead of just uptime) - Add actual RTC timestamp (instead of just uptime)
- Add WiFi signal strength (RSSI) for WiFi connections
- Add free heap memory - Add free heap memory
- Add current playback status - Add current playback status
- Add bell configuration version/hash - Add bell configuration version/hash
### Implementation Example:
```cpp
// In publishHeartbeat()
payload["rssi"] = WiFi.RSSI(); // WiFi signal strength
payload["free_heap"] = ESP.getFreeHeap();
payload["playback_active"] = player.isPlaying;
```
## Configuration ## Configuration
### Current Settings (can be changed in MQTTAsyncClient.hpp): ### Current Settings (can be changed in MQTTAsyncClient.hpp):
+2 -1
View File
@@ -931,7 +931,8 @@ These messages are published by the device without a request. See [mqtt-events.m
"timestamp": "Uptime: 5h 23m 45s", "timestamp": "Uptime: 5h 23m 45s",
"ip_address": "10.0.0.3", "ip_address": "10.0.0.3",
"gateway": "10.0.0.1", "gateway": "10.0.0.1",
"uptime_ms": 19425000 "uptime_ms": 19425000,
"rssi": -62
} }
} }
``` ```
@@ -409,6 +409,9 @@ void MQTTDriver::publishHeartbeat() {
// Uptime in milliseconds // Uptime in milliseconds
payload["uptime_ms"] = uptimeMs; payload["uptime_ms"] = uptimeMs;
// WiFi signal strength
payload["rssi"] = WiFi.RSSI();
// Serialize to string // Serialize to string
String heartbeatMessage; String heartbeatMessage;
serializeJson(doc, heartbeatMessage); serializeJson(doc, heartbeatMessage);
@@ -61,7 +61,7 @@ Reconnect attempts are reset to 0 on a successful connection or a new `onNetwork
## Heartbeat ## Heartbeat
Once connected, a heartbeat is published immediately and then every 30 seconds to `vesper/{uid}/status/heartbeat` with `retain = true`. Heartbeat payload includes `device_id`, `firmware_version`, `ip_address`, `gateway`, `uptime_ms`, and an uptime string. The heartbeat timer is stopped on disconnect and restarted on reconnect. Once connected, a heartbeat is published immediately and then every 30 seconds to `vesper/{uid}/status/heartbeat` with `retain = true`. Heartbeat payload includes `device_id`, `firmware_version`, `ip_address`, `gateway`, `uptime_ms`, `rssi`, and an uptime string. The heartbeat timer is stopped on disconnect and restarted on reconnect.
--- ---