mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
hearbeat in JSON - https://github.com/proddy/EMS-ESP/issues/217
This commit is contained in:
@@ -9,10 +9,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Added
|
||||
|
||||
- Report # TCP dropouts in the `system` command. These could be due to WiFI or MQTT disconnected.
|
||||
- Added temp and mode to the MQTT `thermostat_cmd` topic
|
||||
|
||||
### Fixed
|
||||
|
||||
### Changed
|
||||
|
||||
- Heartbeat MQTT payload is now in JSON
|
||||
|
||||
### Removed
|
||||
|
||||
## [1.9.2] 2019-10-19
|
||||
@@ -41,6 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- All MQTT topics for the Thermostat have the Heating Circuit appended (e.g. `thermostat_data1`). This includes the commands.
|
||||
- Shower timer and shower alert and not MQTT published at boot up
|
||||
- Heating Active logic change to use Selected Flow Temp of min 30 instead of 70 (https://github.com/proddy/EMS-ESP/issues/193)
|
||||
- Cleaned up Telnet messages during bootup to only show key information.
|
||||
|
||||
### Removed
|
||||
|
||||
|
||||
@@ -1379,23 +1379,22 @@ void MyESP::_heartbeatCheck(bool force = false) {
|
||||
uint32_t free_memory = ESP.getFreeHeap();
|
||||
uint8_t mem_available = 100 * free_memory / total_memory; // as a %
|
||||
|
||||
char payload[300] = {0};
|
||||
char s[10];
|
||||
strlcpy(payload, "version=", sizeof(payload));
|
||||
strlcat(payload, _app_version, sizeof(payload)); // version
|
||||
strlcat(payload, ", IP=", sizeof(payload));
|
||||
strlcat(payload, WiFi.localIP().toString().c_str(), sizeof(payload)); // IP address
|
||||
strlcat(payload, ", rssid=", sizeof(payload));
|
||||
strlcat(payload, itoa(getWifiQuality(), s, 10), sizeof(payload)); // rssi %
|
||||
strlcat(payload, "%, load=", sizeof(payload));
|
||||
strlcat(payload, ltoa(getSystemLoadAverage(), s, 10), sizeof(payload)); // load
|
||||
strlcat(payload, "%, uptime=", sizeof(payload));
|
||||
strlcat(payload, ltoa(_getUptime(), s, 10), sizeof(payload)); // uptime in secs
|
||||
strlcat(payload, "secs, freemem=", sizeof(payload));
|
||||
strlcat(payload, itoa(mem_available, s, 10), sizeof(payload)); // free mem as a %
|
||||
strlcat(payload, "%", sizeof(payload));
|
||||
StaticJsonDocument<200> doc;
|
||||
JsonObject rootHeartbeat = doc.to<JsonObject>();
|
||||
|
||||
mqttPublish(MQTT_TOPIC_HEARTBEAT, payload, false); // send to MQTT with retain off
|
||||
rootHeartbeat["version"] = _app_version;
|
||||
rootHeartbeat["IP"] = WiFi.localIP().toString().c_str();
|
||||
rootHeartbeat["rssid"] = getWifiQuality();
|
||||
rootHeartbeat["load"] = getSystemLoadAverage();
|
||||
rootHeartbeat["uptime"] = _getUptime();
|
||||
rootHeartbeat["freemem"] = mem_available;
|
||||
|
||||
char data[300] = {0};
|
||||
serializeJson(doc, data, sizeof(data));
|
||||
|
||||
// myDebugLog("Publishing hearbeat via MQTT");
|
||||
|
||||
(void)mqttPublish(MQTT_TOPIC_HEARTBEAT, data, false); // send to MQTT with retain off
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define APP_VERSION "1.9.3b2"
|
||||
#define APP_VERSION "1.9.3b3"
|
||||
|
||||
Reference in New Issue
Block a user