Skip to content

Commit

Permalink
Publish ESP heap and temperature details on Mqtt
Browse files Browse the repository at this point in the history
  • Loading branch information
ranma committed Sep 9, 2024
1 parent cec4003 commit 6b42991
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/MqttHandleDtu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "MqttSettings.h"
#include "NetworkSettings.h"
#include <Hoymiles.h>
#include <CpuTemperature.h>

MqttHandleDtuClass MqttHandleDtu;

Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 6b42991

Please sign in to comment.