From bce3fc78e8a90071f414a081f9285ba179fcbb66 Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Fri, 24 Jun 2022 18:03:44 +0200 Subject: [PATCH] Renamed field names which are used for mqtt and web ui --- lib/Hoymiles/src/inverters/InverterAbstract.h | 4 ++-- src/MqttPublishing.cpp | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Hoymiles/src/inverters/InverterAbstract.h b/lib/Hoymiles/src/inverters/InverterAbstract.h index 5c7d3319..8c0034e2 100644 --- a/lib/Hoymiles/src/inverters/InverterAbstract.h +++ b/lib/Hoymiles/src/inverters/InverterAbstract.h @@ -31,8 +31,8 @@ enum { FLD_UDC = 0, FLD_PCT, FLD_EFF, FLD_IRR }; -const char* const fields[] = { "U_DC", "I_DC", "P_DC", "YieldDay", "YieldTotal", - "U_AC", "I_AC", "P_AC", "Freq", "Temp", "Pct", "Effiency", "Irradiation" }; +const char* const fields[] = { "Voltage", "Current", "Power", "YieldDay", "YieldTotal", + "Voltage", "Current", "Power", "Frequency", "Temperature", "PowerFactor", "Effiency", "Irradiation" }; // indices to calculation functions, defined in hmInverter.h enum { CALC_YT_CH0 = 0, diff --git a/src/MqttPublishing.cpp b/src/MqttPublishing.cpp index 6d7df5b5..4bf018a2 100644 --- a/src/MqttPublishing.cpp +++ b/src/MqttPublishing.cpp @@ -63,6 +63,8 @@ void MqttPublishingClass::loop() void MqttPublishingClass::publishField(String subtopic, std::shared_ptr inv, uint8_t channel, uint8_t fieldId) { if (inv->hasChannelFieldValue(channel, fieldId)) { - MqttSettings.publish(subtopic + "/" + String(channel) + "/" + inv->getChannelFieldName(channel, fieldId), String(inv->getChannelFieldValue(channel, fieldId))); + String chanName(inv->getChannelFieldName(channel, fieldId)); + chanName.toLowerCase(); + MqttSettings.publish(subtopic + "/" + String(channel) + "/" + chanName, String(inv->getChannelFieldValue(channel, fieldId))); } } \ No newline at end of file