no message
This commit is contained in:
@@ -135,7 +135,8 @@ class Bat_EV_SDL_V4 extends IPSModule
|
|||||||
"SDL_W" => round((float)GetValue($this->GetIDForIdent("Aktuelle_Leistung_SDL")), 0)
|
"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) {
|
} catch (Throwable $e) {
|
||||||
$this->SendDebug("Update ERROR", $e->getMessage() . " @ " . $e->getFile() . ":" . $e->getLine(), 0);
|
$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
|
private function SetIdentValue(string $ident, $value): void
|
||||||
{
|
{
|
||||||
$id = @$this->GetIDForIdent($ident);
|
$id = @$this->GetIDForIdent($ident);
|
||||||
|
|||||||
Reference in New Issue
Block a user