MQTT Hass: Change parameter order for publishDtuSensor

This commit is contained in:
Thomas Basler 2024-09-24 19:06:00 +02:00
parent 96e83f3d37
commit 1c3e7de390
2 changed files with 11 additions and 10 deletions

View File

@ -59,7 +59,7 @@ public:
private:
void loop();
void publish(const String& subtopic, const String& payload);
void publishDtuSensor(const String& name, const String& device_class, const String& category, const String& icon, const String& unit_of_measure, const String& subTopic);
void publishDtuSensor(const String& name, const String& subTopic, const String& unit_of_measure, const String& icon, const String& device_class, const String& category);
void publishDtuBinarySensor(const String& name, const String& device_class, const String& category, const String& payload_on, const String& payload_off, const String& subTopic = "");
void publishInverterField(std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const byteAssign_fieldDeviceClass_t fieldType, const bool clear = false);
void publishInverterButton(std::shared_ptr<InverterAbstract> inv, const String& name, const String& icon, const String& category, const String& deviceClass, const String& subTopic, const String& payload);

View File

@ -58,14 +58,15 @@ void MqttHandleHassClass::publishConfig()
const CONFIG_T& config = Configuration.get();
// publish DTU sensors
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");
publishDtuSensor("IP", "ip", "", "mdi:network-outline", "", "diagnostic");
publishDtuSensor("WiFi Signal", "rssi", "dBm", "", "signal_strength", "diagnostic");
publishDtuSensor("Uptime", "uptime", "s", "", "duration", "diagnostic");
publishDtuSensor("Temperature", "temperature", "°C", "mdi:thermometer", "temperature", "diagnostic");
publishDtuSensor("Heap Size", "heap/size", "Bytes", "mdi:memory", "", "diagnostic");
publishDtuSensor("Heap Free", "heap/free", "Bytes", "mdi:memory", "", "diagnostic");
publishDtuSensor("Largest Free Heap Block", "heap/maxalloc", "Bytes", "mdi:memory", "", "diagnostic");
publishDtuSensor("Lifetime Minimum Free Heap", "heap/minfree", "Bytes", "mdi:memory", "", "diagnostic");
publishDtuBinarySensor("Status", "connectivity", "diagnostic", config.Mqtt.Lwt.Value_Online, config.Mqtt.Lwt.Value_Offline, config.Mqtt.Lwt.Topic);
yield();
@ -355,7 +356,7 @@ void MqttHandleHassClass::publishInverterSensor(std::shared_ptr<InverterAbstract
publish(configTopic, buffer);
}
void MqttHandleHassClass::publishDtuSensor(const String& name, const String& device_class, const String& category, const String& icon, const String& unit_of_measure, const String& subTopic)
void MqttHandleHassClass::publishDtuSensor(const String& name, const String& subTopic, const String& unit_of_measure, const String& icon, const String& device_class, const String& category)
{
String id = name;
id.toLowerCase();