From a302f9163c90ae2ed7961dd99c82a1e61bed1679 Mon Sep 17 00:00:00 2001 From: "belevo\\mh" Date: Mon, 11 May 2026 07:13:20 +0200 Subject: [PATCH] no message --- Bat_EV_SDL_V4/module.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Bat_EV_SDL_V4/module.php b/Bat_EV_SDL_V4/module.php index f297cdf..4230d2b 100644 --- a/Bat_EV_SDL_V4/module.php +++ b/Bat_EV_SDL_V4/module.php @@ -689,7 +689,7 @@ class Bat_EV_SDL_V4 extends IPSModule private function WriteBatteryPowerSetpoints(array $distribution): void { - IPS_LogMessage(__FUNCTION__, "distribution=" . json_encode($distribution, JSON_PRETTY_PRINT)); + //IPS_LogMessage(__FUNCTION__, "distribution=" . json_encode($distribution, JSON_PRETTY_PRINT)); $batteriesCfg = json_decode($this->ReadPropertyString("Batteries"), true); if (!is_array($batteriesCfg) || empty($batteriesCfg)) { @@ -727,6 +727,7 @@ class Bat_EV_SDL_V4 extends IPSModule $varPowerDisch = (int)($cfg["powerbat_entladen"] ?? 0); $varMode = (int)($cfg["register_ladenentladen_modus"] ?? 0); + /* $setInt = function (int $varId, int $value): void { if ($varId > 0 && IPS_VariableExists($varId)) { RequestAction($varId, $value); @@ -738,6 +739,28 @@ class Bat_EV_SDL_V4 extends IPSModule RequestAction($varId, (int)round(max(0.0, $w), 0)); } }; + */ + + $setInt = function (int $varId, int $value): void { + if ($varId > 0 && IPS_VariableExists($varId)) { + $old = (int)GetValue($varId); + + if ($old !== $value) { + RequestAction($varId, $value); + } + } + }; + + $setW = function (int $varId, float $w): void { + if ($varId > 0 && IPS_VariableExists($varId)) { + $new = (int)round(max(0.0, $w), 0); + $old = (int)GetValue($varId); + + if (abs($old - $new) > 50) { + RequestAction($varId, $new); + } + } + }; $modeCharge = 1; $modeDisch = 2;