Skip to content

Commit

Permalink
Merge branch 'pr2293' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
tbnobody committed Sep 22, 2024
2 parents 175e575 + fdcbf9d commit a1fddb4
Show file tree
Hide file tree
Showing 2 changed files with 11 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/heap/size", String(ESP.getHeapSize()));
MqttSettings.publish("dtu/heap/free", String(ESP.getFreeHeap()));
MqttSettings.publish("dtu/heap/minfree", String(ESP.getMinFreeHeap()));
MqttSettings.publish("dtu/heap/maxalloc", String(ESP.getMaxAllocHeap()));
if (NetworkSettings.NetworkMode() == network_mode::WiFi) {
MqttSettings.publish("dtu/rssi", String(WiFi.RSSI()));
MqttSettings.publish("dtu/bssid", WiFi.BSSIDstr());
Expand Down
5 changes: 5 additions & 0 deletions src/MqttHandleHass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ void MqttHandleHassClass::publishConfig()
publishDtuSensor("IP", "", "diagnostic", "mdi:network-outline", "", "");
publishDtuSensor("WiFi Signal", "signal_strength", "diagnostic", "", "dBm", "rssi");
publishDtuSensor("Uptime", "duration", "diagnostic", "", "s", "");
publishDtuSensor("Temperature", "temperature", "diagnostic", "mdi:thermometer", "°C", "temperature");
publishDtuSensor("Heap Size", "", "diagnostic", "mdi:memory", "Bytes", "heap/size");
publishDtuSensor("Heap Free", "", "diagnostic", "mdi:memory", "Bytes", "heap/free");
publishDtuSensor("Largest Free Heap Block", "", "diagnostic", "mdi:memory", "Bytes", "heap/maxalloc`");
publishDtuSensor("Lifetime Minimum Free Heap", "", "diagnostic", "mdi:memory", "Bytes", "heap/minfree`");
publishDtuBinarySensor("Status", "connectivity", "diagnostic", config.Mqtt.Lwt.Value_Online, config.Mqtt.Lwt.Value_Offline, config.Mqtt.Lwt.Topic);

yield();
Expand Down

0 comments on commit a1fddb4

Please sign in to comment.