no message

This commit is contained in:
belevo\mh
2026-05-04 19:31:47 +02:00
parent 531c7907cd
commit fcdb1c22a8
+18 -1
View File
@@ -135,7 +135,8 @@ class Bat_EV_SDL_V4 extends IPSModule
"SDL_W" => round((float)GetValue($this->GetIDForIdent("Aktuelle_Leistung_SDL")), 0)
];
$this->SetIdentValue("CalcJSON", json_encode($calc, JSON_PRETTY_PRINT));
$calcRounded = $this->RoundArray($calc, 3);
$this->SetIdentValue("CalcJSON", json_encode($calcRounded, JSON_PRETTY_PRINT));
} catch (Throwable $e) {
$this->SendDebug("Update ERROR", $e->getMessage() . " @ " . $e->getFile() . ":" . $e->getLine(), 0);
@@ -796,6 +797,22 @@ class Bat_EV_SDL_V4 extends IPSModule
}
}
private function RoundArray($data, int $decimals = 3)
{
if (is_array($data)) {
foreach ($data as $k => $v) {
$data[$k] = $this->RoundArray($v, $decimals);
}
return $data;
}
if (is_float($data)) {
return round($data, $decimals);
}
return $data;
}
private function SetIdentValue(string $ident, $value): void
{
$id = @$this->GetIDForIdent($ident);