diff --git a/Bat_EV_SDL _V2/module.php b/Bat_EV_SDL _V2/module.php index 054c109..1035356 100644 --- a/Bat_EV_SDL _V2/module.php +++ b/Bat_EV_SDL _V2/module.php @@ -615,14 +615,22 @@ private function CalculateBatteryDistribution(float $pEvW, float $pSdlW): array } $totalPower_ist = 0; - + print_r($batteries); foreach ($batteries as $bat) { - $totalPower_ist += GetValue($bat['register_bat_power']); + $totalPower_ist += 0; // GetValue($bat['register_bat_power']); } - + + if(($pEvW + $pSdlW) === 0){ + + $this->SetValue("Aktuelle_Leistung_EV", $totalPower_ist/2); + $this->SetValue("Aktuelle_Leistung_SDL", $totalPower_ist/2); + + }else{ + $this->SetValue("Aktuelle_Leistung_EV", $totalPower_ist/($pEvW + $pSdlW)*$pEvW); $this->SetValue("Aktuelle_Leistung_SDL", $totalPower_ist/($pEvW + $pSdlW)*$pSdlW); + } return $finalOutput; }