From 7ac5330541612cdcdc8b8e2e293fc9df0829a5a1 Mon Sep 17 00:00:00 2001 From: "belevo\\mh" Date: Tue, 12 May 2026 10:33:24 +0200 Subject: [PATCH] no message --- Bat_EV_SDL_V4/module.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Bat_EV_SDL_V4/module.php b/Bat_EV_SDL_V4/module.php index 3d06808..b39a86f 100644 --- a/Bat_EV_SDL_V4/module.php +++ b/Bat_EV_SDL_V4/module.php @@ -416,8 +416,14 @@ class Bat_EV_SDL_V4 extends IPSModule $sdlStartPct = max(0.0, min(100.0, (float)$this->ReadPropertyFloat("SDL_Start_Pos_Config"))); $evStartPct = max(0.0, min(100.0, (float)$this->ReadPropertyFloat("EV_Start_Pos_Config"))); - $eSDL = ($sdlTotal > 0.0) ? $sdlTotal * $sdlStartPct / 100.0 : 0.0; - $eEV = ($evTotal > 0.0) ? $evTotal * $evStartPct / 100.0 : 0.0; + $lastSdlPct = (float)GetValue($this->GetIDForIdent("SDL_Pos")); + $lastEvPct = (float)GetValue($this->GetIDForIdent("SoC_EV")); + + $lastSdlPct = max(0.0, min(100.0, $lastSdlPct)); + $lastEvPct = max(0.0, min(100.0, $lastEvPct)); + + $eSDL = ($sdlTotal > 0.0) ? $sdlTotal * $lastSdlPct / 100.0 : 0.0; + $eEV = ($evTotal > 0.0) ? $evTotal * $lastEvPct / 100.0 : 0.0; $this->SetBuffer("Int_E_SDL_kWh", (string)$eSDL); $this->SetBuffer("Int_E_EV_kWh", (string)$eEV);