From 38f450b00eda83cf224a97e450226a76b02695c6 Mon Sep 17 00:00:00 2001 From: "belevo\\mh" Date: Wed, 17 Dec 2025 08:36:43 +0100 Subject: [PATCH] no message --- Energy_Pie/module.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Energy_Pie/module.php b/Energy_Pie/module.php index ca74b0b..5345790 100644 --- a/Energy_Pie/module.php +++ b/Energy_Pie/module.php @@ -100,16 +100,17 @@ private function RecalculateAndPush(): void [$tStart, $tEnd] = $this->getRange($range, $date); - // Archiv-Deltas - $prod = $this->readDelta($this->ReadPropertyInteger('VarProduction'), $tStart, $tEnd); - $feed = $this->readDelta($this->ReadPropertyInteger('VarFeedIn'), $tStart, $tEnd); - $grid = $this->readDelta($this->ReadPropertyInteger('VarGrid'), $tStart, $tEnd); + // Debug-Container initialisieren (sonst "Undefined variable") + $dbgProd = null; + $dbgFeed = null; + $dbgGrid = null; + + $prod = $this->readDelta($this->ReadPropertyInteger('VarProduction'), $tStart, $tEnd, $dbgProd); + $feed = $this->readDelta($this->ReadPropertyInteger('VarFeedIn'), $tStart, $tEnd, $dbgFeed); + $grid = $this->readDelta($this->ReadPropertyInteger('VarGrid'), $tStart, $tEnd, $dbgGrid); - // Hausverbrauch = Produktion - Einspeisung + Netz $house = $prod - $feed + $grid; - if ($house < 0) { - $house = 0.0; - } + if ($house < 0) $house = 0.0; $payload = [ 'range' => $range, @@ -117,10 +118,10 @@ private function RecalculateAndPush(): void 'tStart' => $tStart, 'tEnd' => $tEnd, 'values' => [ - 'Produktion' => (float)$prod, - 'Einspeisung' => (float)$feed, - 'Netz' => (float)$grid, - 'Hausverbrauch'=> (float)$house + 'Produktion' => (float)$prod, + 'Einspeisung' => (float)$feed, + 'Netz' => (float)$grid, + 'Hausverbrauch' => (float)$house ], 'debug' => [ 'prod' => $dbgProd,