From a13425baba2c5572080396d2fc1feef1be9a43d7 Mon Sep 17 00:00:00 2001 From: chpro Date: Thu, 11 Jul 2024 20:09:32 +0200 Subject: [PATCH] only apply offset on low temperature --- app/influxdataprovider.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/influxdataprovider.js b/app/influxdataprovider.js index 21761db..78932c2 100644 --- a/app/influxdataprovider.js +++ b/app/influxdataprovider.js @@ -99,8 +99,9 @@ function processStatusValues(currentStatusValues) { var wattGridUsage = null if (currentStatusValues.inverterPowerFlow !== null) { // the usage is calculated without power flow to battery and wattpilot usage - console.log(new Date(), "WattGridUsage is calculated from inverterPowerFlow and wattpilot usage"); - wattGridUsage = (currentStatusValues.inverterPowerFlow.P_PV + currentStatusValues.wattpilot.power - Math.abs(currentStatusValues.inverterPowerFlow.P_Load)) * -1 + var offset = currentStatusValues.currentWaterTemperature >= CONFIG.maxWaterTemperatureFallback ? 0 : currentStatusValues.wattpilot.power; + console.log(new Date(), "WattGridUsage is calculated from inverterPowerFlow and offset ", offset); + wattGridUsage = (currentStatusValues.inverterPowerFlow.P_PV + offset - Math.abs(currentStatusValues.inverterPowerFlow.P_Load)) * -1 } else {// fallback and also used for test cases console.log(new Date(), "WattGridUsage is calculated from wattGridUsageMean/Max"); wattGridUsage = currentStatusValues.switchOn ? currentStatusValues.wattGridUsageLast : Math.max(currentStatusValues.wattGridUsageMean, currentStatusValues.wattGridUsageLast);