From 7d2fb3490ea0949017bc1305cb54e23782a68af9 Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Sat, 4 May 2024 22:24:40 +0200 Subject: [PATCH] Fix #1960: Prometheus API return wrong information in function addPanelInfo --- src/WebApi_prometheus.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/WebApi_prometheus.cpp b/src/WebApi_prometheus.cpp index f0a0d7b47..ad95aacbf 100644 --- a/src/WebApi_prometheus.cpp +++ b/src/WebApi_prometheus.cpp @@ -143,7 +143,7 @@ void WebApiPrometheusClass::addPanelInfo(AsyncResponseStream* stream, const Stri return; } - const CONFIG_T& config = Configuration.get(); + const auto& config = Configuration.getInverterConfig(inv->serial()); const bool printHelp = (idx == 0 && channel == 0); if (printHelp) { @@ -155,7 +155,7 @@ void WebApiPrometheusClass::addPanelInfo(AsyncResponseStream* stream, const Stri idx, inv->name(), channel, - config.Inverter[idx].channel[channel].Name); + config->channel[channel].Name); if (printHelp) { stream->print("# HELP opendtu_MaxPower panel maximum output power\n"); @@ -166,7 +166,7 @@ void WebApiPrometheusClass::addPanelInfo(AsyncResponseStream* stream, const Stri idx, inv->name(), channel, - config.Inverter[idx].channel[channel].MaxChannelPower); + config->channel[channel].MaxChannelPower); if (printHelp) { stream->print("# HELP opendtu_YieldTotalOffset panel yield offset (for used inverters)\n"); @@ -177,5 +177,5 @@ void WebApiPrometheusClass::addPanelInfo(AsyncResponseStream* stream, const Stri idx, inv->name(), channel, - config.Inverter[idx].channel[channel].YieldTotalOffset); + config->channel[channel].YieldTotalOffset); }