Skip to content

Commit

Permalink
only apply offset on low temperature
Browse files Browse the repository at this point in the history
  • Loading branch information
chpro committed Jul 11, 2024
1 parent 48bd8d5 commit a13425b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/influxdataprovider.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a13425b

Please sign in to comment.