feat(ladestation): Phasenerkennung und Schaltsperren erweitern
Tests / test (push) Successful in 45s
Tests / test (push) Successful in 45s
This commit is contained in:
@@ -91,7 +91,7 @@ final class LadestationAdapter
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{Rohstatus: int, Istleistung_W: float, Iststrom_A?: float}
|
||||
* @return array{Rohstatus: int, Istleistung_W: float, Iststrom_A?: float, Phasenzahl?: int}
|
||||
*/
|
||||
public static function dekodiereStatus(int $geraetetyp, string $antwort): array
|
||||
{
|
||||
@@ -121,11 +121,19 @@ final class LadestationAdapter
|
||||
&& is_numeric($daten['nrg'][6])
|
||||
) {
|
||||
$stromfaktor = $geraetetyp === self::GO_E_ALT ? 0.1 : 1.0;
|
||||
$status['Iststrom_A'] = max(
|
||||
(float) $daten['nrg'][4],
|
||||
(float) $daten['nrg'][5],
|
||||
(float) $daten['nrg'][6]
|
||||
) * $stromfaktor;
|
||||
$phasenstroeme = [
|
||||
(float) $daten['nrg'][4] * $stromfaktor,
|
||||
(float) $daten['nrg'][5] * $stromfaktor,
|
||||
(float) $daten['nrg'][6] * $stromfaktor,
|
||||
];
|
||||
$status['Iststrom_A'] = max($phasenstroeme);
|
||||
$aktivePhasen = count(array_filter(
|
||||
$phasenstroeme,
|
||||
static fn (float $strom): bool => $strom >= 1.0
|
||||
));
|
||||
if ($aktivePhasen > 0) {
|
||||
$status['Phasenzahl'] = $aktivePhasen >= 2 ? 3 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
return $status;
|
||||
|
||||
Reference in New Issue
Block a user