diff --git a/Bat_EV_SDL_V4/module.php b/Bat_EV_SDL_V4/module.php index bc89f65..38b7708 100644 --- a/Bat_EV_SDL_V4/module.php +++ b/Bat_EV_SDL_V4/module.php @@ -66,10 +66,16 @@ class Bat_EV_SDL_V4 extends IPSModule ($intervalSec > 0) ? $intervalSec * 1000 : 0 ); - $this->BuildBatteryPlan(true); - $this->InitVirtualAccountsIfNeeded(); + $this->BuildBatteryPlan(true); - $this->Update(); + // Kein automatischer Reset der virtuellen Konten bei ApplyChanges. + // Nur Initialisierung von Zeitstempel/Init-Flag, falls noch nie vorhanden. + if ($this->GetBufferSafe("Int_Init") !== "1") { + $this->SetBuffer("Int_LastTs", (string)microtime(true)); + $this->SetBuffer("Int_Init", "1"); + } + + $this->Update(); } public function RequestAction($Ident, $Value) @@ -345,10 +351,10 @@ class Bat_EV_SDL_V4 extends IPSModule private function InitVirtualAccountsIfNeeded(): void { - if ($this->GetBufferSafe("Int_Init") === "1") { - return; + if ($this->GetBufferSafe("Int_Init") !== "1") { + $this->SetBuffer("Int_LastTs", (string)microtime(true)); + $this->SetBuffer("Int_Init", "1"); } - $this->ResetVirtualAccounts(); } public function ResetVirtualAccounts(): void