From d19fe26299dfd8ab08bf8eba7456faec128009f7 Mon Sep 17 00:00:00 2001 From: "belevo\\mh" Date: Tue, 18 Aug 2026 07:37:58 +0200 Subject: [PATCH] no message --- Bat_EV_SDL_V4/module.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Bat_EV_SDL_V4/module.php b/Bat_EV_SDL_V4/module.php index 5e5a377..58de5de 100644 --- a/Bat_EV_SDL_V4/module.php +++ b/Bat_EV_SDL_V4/module.php @@ -593,11 +593,25 @@ class Bat_EV_SDL_V4 extends IPSModule $globalSDLpct = ($sdlTotal > 0.0) ? max(0.0, min(100.0, $virtSDL / $sdlTotal * 100.0)) : 0.0; $globalEVpct = ($evTotal > 0.0) ? max(0.0, min(100.0, $virtEV / $evTotal * 100.0)) : 0.0; + /* foreach ($batteries as &$bat) { // Mit globalem virtuellem SoC sortieren. Bei Bedarf später pro Batterie virtualisieren. $bat["SDL_SOC"] = $globalSDLpct; $bat["EV_SOC"] = $globalEVpct; } + unset($bat);*/ + + //SoC nach priosierung + foreach ($batteries as &$bat) { + + // Reale Batterie-SoC als Sortierwert verwenden. + // Laden: Batterie mit tieferem SoC zuerst. + // Entladen: Batterie mit höherem SoC zuerst. + $realSocPct = (float)($bat["real_SOC_pct"] ?? 0.0); + + $bat["SDL_SOC"] = $realSocPct; + $bat["EV_SOC"] = $realSocPct; + } unset($bat); $distributePower = function (float $targetPower, string $mode) use ($batteries): array {