Fix #1960: Prometheus API return wrong information in function addPanelInfo

This commit is contained in:
Thomas Basler 2024-05-04 22:24:40 +02:00
parent d5a24906fa
commit 7d2fb3490e

View File

@ -143,7 +143,7 @@ void WebApiPrometheusClass::addPanelInfo(AsyncResponseStream* stream, const Stri
return; return;
} }
const CONFIG_T& config = Configuration.get(); const auto& config = Configuration.getInverterConfig(inv->serial());
const bool printHelp = (idx == 0 && channel == 0); const bool printHelp = (idx == 0 && channel == 0);
if (printHelp) { if (printHelp) {
@ -155,7 +155,7 @@ void WebApiPrometheusClass::addPanelInfo(AsyncResponseStream* stream, const Stri
idx, idx,
inv->name(), inv->name(),
channel, channel,
config.Inverter[idx].channel[channel].Name); config->channel[channel].Name);
if (printHelp) { if (printHelp) {
stream->print("# HELP opendtu_MaxPower panel maximum output power\n"); stream->print("# HELP opendtu_MaxPower panel maximum output power\n");
@ -166,7 +166,7 @@ void WebApiPrometheusClass::addPanelInfo(AsyncResponseStream* stream, const Stri
idx, idx,
inv->name(), inv->name(),
channel, channel,
config.Inverter[idx].channel[channel].MaxChannelPower); config->channel[channel].MaxChannelPower);
if (printHelp) { if (printHelp) {
stream->print("# HELP opendtu_YieldTotalOffset panel yield offset (for used inverters)\n"); stream->print("# HELP opendtu_YieldTotalOffset panel yield offset (for used inverters)\n");
@ -177,5 +177,5 @@ void WebApiPrometheusClass::addPanelInfo(AsyncResponseStream* stream, const Stri
idx, idx,
inv->name(), inv->name(),
channel, channel,
config.Inverter[idx].channel[channel].YieldTotalOffset); config->channel[channel].YieldTotalOffset);
} }