no message

This commit is contained in:
belevo\mh
2026-05-11 07:13:20 +02:00
parent b330058d5b
commit a302f9163c
+24 -1
View File
@@ -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;