From 9f22ae0aa75380f3b6d04d88158c7fbc62f6c874 Mon Sep 17 00:00:00 2001 From: "belevo\\mh" Date: Mon, 26 Jan 2026 14:56:00 +0100 Subject: [PATCH] no message --- Bat_EV_SDL/form.json | 10 ++-------- Bat_EV_SDL/module.php | 23 +++++++++++++++++------ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Bat_EV_SDL/form.json b/Bat_EV_SDL/form.json index dad2635..191ac69 100644 --- a/Bat_EV_SDL/form.json +++ b/Bat_EV_SDL/form.json @@ -102,14 +102,8 @@ }, { "type": "NumberSpinner", - "name": "SDL_Lade_Leistung", - "caption": "SDL_Lade_Leistung", - "suffix": "W" - }, - { - "type": "NumberSpinner", - "name": "SDL_Entlade_Leistung", - "caption": "SDL_Entlade_Leistung", + "name": "SDL_Leistung", + "caption": "SDL_Leistung", "suffix": "W" }, { diff --git a/Bat_EV_SDL/module.php b/Bat_EV_SDL/module.php index 75e7cac..d05beeb 100644 --- a/Bat_EV_SDL/module.php +++ b/Bat_EV_SDL/module.php @@ -8,8 +8,7 @@ class Bat_EV_SDL extends IPSModule // Properties $this->RegisterPropertyString("Batteries", "[]"); - $this->RegisterPropertyInteger("SDL_Lade_Leistung", 0); - $this->RegisterPropertyInteger("SDL_Entlade_Leistung", 0); // W + $this->RegisterPropertyInteger("SDL_Leistung", 0); // W $this->RegisterPropertyInteger("UpdateInterval", 5); // Minuten // Status @@ -70,13 +69,17 @@ class Bat_EV_SDL extends IPSModule $batteries = []; } +<<<<<<< HEAD //-------------------------------------------------- /* +======= +>>>>>>> parent of 2eab6b6 (no message) $sdlTotalW = (float)$this->ReadPropertyInteger("SDL_Leistung"); // W if ($sdlTotalW < 0) $sdlTotalW = 0; $sdlTotalkW = $sdlTotalW / 1000.0; +<<<<<<< HEAD """ */ @@ -108,6 +111,8 @@ class Bat_EV_SDL extends IPSModule } //--------------------------------------------- +======= +>>>>>>> parent of 2eab6b6 (no message) // 30 Minuten Fenster $hours = 0.5; @@ -128,8 +133,7 @@ class Bat_EV_SDL extends IPSModule $calc = [ "inputs" => [ - "SDL_Entlade_Leistung_W" => round($sdlTotalEntladeW, 0), - "SDL_Lade_Leistung_W" => round($sdlTotalLadeW, 0), + "SDL_Leistung_W" => round($sdlTotalW, 0), "SumBatPower_W" => round($sumBatPowerW, 0), "hours" => $hours ], @@ -187,13 +191,15 @@ class Bat_EV_SDL extends IPSModule continue; } - // Deine Logik: SDL/EV Aufteilung über Leistungsanteil - $sdlShareKW = ($sumBatPowerkW > 0.0) ? ($sdlTotalkW / $sumBatPowerkW * $pBatkW) : 0.0; $evShareKW = $pBatkW - $sdlShareKW; + // untere Grenze für SDL (wichtig: zuerst setzen, dann clamp) + $underKWh = $sdlShareKW * $hours; + $underKWh = max(0.0, min($underKWh, $capKWh / 2.0)); +<<<<<<< HEAD if ($mode == 'charge') { $ver = $sdlTotalLadekW / $sdlTotalEntladekW; $underKWh = ($sdlShareKW * $hours) / $ver; @@ -221,6 +227,11 @@ class Bat_EV_SDL extends IPSModule +======= + $upKWh = $capKWh - $underKWh; + $SDL_kWh = 2.0 * $underKWh; + $EV_kWH = max(0.0, $capKWh - $SDL_kWh); +>>>>>>> parent of 2eab6b6 (no message) $real_kWh = $capKWh / 100.0 * $socPct;