Renamed field names which are used for mqtt and web ui

This commit is contained in:
Thomas Basler 2022-06-24 18:03:44 +02:00
parent 2de865037c
commit bce3fc78e8
2 changed files with 5 additions and 3 deletions

View File

@ -31,8 +31,8 @@ enum { FLD_UDC = 0,
FLD_PCT, FLD_PCT,
FLD_EFF, FLD_EFF,
FLD_IRR }; FLD_IRR };
const char* const fields[] = { "U_DC", "I_DC", "P_DC", "YieldDay", "YieldTotal", const char* const fields[] = { "Voltage", "Current", "Power", "YieldDay", "YieldTotal",
"U_AC", "I_AC", "P_AC", "Freq", "Temp", "Pct", "Effiency", "Irradiation" }; "Voltage", "Current", "Power", "Frequency", "Temperature", "PowerFactor", "Effiency", "Irradiation" };
// indices to calculation functions, defined in hmInverter.h // indices to calculation functions, defined in hmInverter.h
enum { CALC_YT_CH0 = 0, enum { CALC_YT_CH0 = 0,

View File

@ -63,6 +63,8 @@ void MqttPublishingClass::loop()
void MqttPublishingClass::publishField(String subtopic, std::shared_ptr<InverterAbstract> inv, uint8_t channel, uint8_t fieldId) void MqttPublishingClass::publishField(String subtopic, std::shared_ptr<InverterAbstract> inv, uint8_t channel, uint8_t fieldId)
{ {
if (inv->hasChannelFieldValue(channel, 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)));
} }
} }