From 6b42991f44cfb0611c27303ddff21c5eac97f08f Mon Sep 17 00:00:00 2001 From: Tobias Diedrich Date: Mon, 9 Sep 2024 15:16:37 +0200 Subject: [PATCH] Publish ESP heap and temperature details on Mqtt --- src/MqttHandleDtu.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/MqttHandleDtu.cpp b/src/MqttHandleDtu.cpp index e8192b2e2..0f69f56d3 100644 --- a/src/MqttHandleDtu.cpp +++ b/src/MqttHandleDtu.cpp @@ -7,6 +7,7 @@ #include "MqttSettings.h" #include "NetworkSettings.h" #include +#include MqttHandleDtuClass MqttHandleDtu; @@ -34,6 +35,11 @@ void MqttHandleDtuClass::loop() MqttSettings.publish("dtu/uptime", String(millis() / 1000)); MqttSettings.publish("dtu/ip", NetworkSettings.localIP().toString()); MqttSettings.publish("dtu/hostname", NetworkSettings.getHostname()); + MqttSettings.publish("dtu/temperature", String(CpuTemperature.read())); + MqttSettings.publish("dtu/heapSize", String(ESP.getHeapSize())); + MqttSettings.publish("dtu/heapFree", String(ESP.getFreeHeap())); + MqttSettings.publish("dtu/heapMinFree", String(ESP.getMinFreeHeap())); + MqttSettings.publish("dtu/heapMaxAlloc", String(ESP.getMaxAllocHeap())); if (NetworkSettings.NetworkMode() == network_mode::WiFi) { MqttSettings.publish("dtu/rssi", String(WiFi.RSSI())); MqttSettings.publish("dtu/bssid", WiFi.BSSIDstr());