fix(ladestation): Fahrzeugstrom nach Lernzeit begrenzen
Tests / test (push) Successful in 56s

This commit is contained in:
dh
2026-09-29 12:47:23 +00:00
parent b3b868cd2a
commit ace1821213
9 changed files with 247 additions and 21 deletions
+10 -6
View File
@@ -13,7 +13,7 @@ final class LadestationAdapterTest extends TestCase
/**
* @dataProvider statusFaelle
* @param array<string, string> $konfiguration
* @param array{Rohstatus: int, Istleistung_W: float} $erwartet
* @param array{Rohstatus: int, Istleistung_W: float, Iststrom_A?: float} $erwartet
*/
public function testStatusaufrufUndDekodierungFuerAlleGeraete(
int $geraetetyp,
@@ -47,16 +47,16 @@ final class LadestationAdapterTest extends TestCase
yield 'go-e alt' => [
LadestationAdapter::GO_E_ALT,
$this->lokaleKonfiguration(),
$this->goEAntwort(2, 1100),
$this->goEAntwort(2, 1100, [160, 158, 159]),
'http://192.0.2.10/mqtt?payload=',
['Rohstatus' => 2, 'Istleistung_W' => 11000.0],
['Rohstatus' => 2, 'Istleistung_W' => 11000.0, 'Iststrom_A' => 16.0],
];
yield 'go-e Gemini' => [
LadestationAdapter::GO_E_GEMINI,
$this->lokaleKonfiguration(),
$this->goEAntwort(2, 2300),
$this->goEAntwort(2, 2300, [9.8, 0, 0]),
'http://192.0.2.10/api/status',
['Rohstatus' => 2, 'Istleistung_W' => 2300.0],
['Rohstatus' => 2, 'Istleistung_W' => 2300.0, 'Iststrom_A' => 9.8],
];
yield 'Smart-me Pico' => [
LadestationAdapter::SMART_ME_PICO,
@@ -161,9 +161,13 @@ final class LadestationAdapterTest extends TestCase
];
}
private function goEAntwort(int $status, float $leistung): string
/** @param list<int|float> $stroeme */
private function goEAntwort(int $status, float $leistung, array $stroeme): string
{
$nrg = array_fill(0, 12, 0);
foreach (array_values($stroeme) as $index => $strom) {
$nrg[4 + $index] = $strom;
}
$nrg[11] = $leistung;
return json_encode(['car' => $status, 'nrg' => $nrg], JSON_THROW_ON_ERROR);