fix(charging): validate status and budget phase detection
Tests / test (push) Waiting to run

Do not latch full on transient zero current; require explicit completion. Validate go-e errors and Pico status/timestamps, keep historical events diagnostic, and preserve faults until a fresh successful poll. Budget the 6 A phase probe through the manager and correct stale phase counts conservatively.

Add adapter, regulator, isolated runtime and Symcon regression cases plus migration documentation. Verified: composer check (402 tests, 1875 assertions), 92 pure-function assertions in Symcon 8.0, git diff --check. No plant deployment or hardware commands.
This commit is contained in:
dh
2026-10-07 18:24:47 +00:00
parent 372b997876
commit 5885681669
10 changed files with 836 additions and 98 deletions
+18 -6
View File
@@ -12,7 +12,7 @@ return static function (TestContext $test): void {
$nrg[4 + $index] = $strom;
}
$nrg[11] = $leistung;
return json_encode(['car' => $status, 'nrg' => $nrg], JSON_THROW_ON_ERROR);
return json_encode(['car' => $status, 'err' => 0, 'nrg' => $nrg], JSON_THROW_ON_ERROR);
};
$definitionen = [
@@ -37,9 +37,11 @@ return static function (TestContext $test): void {
'Benutzername' => 'api-user',
'Passwort' => $testPasswort,
'Testantwort' => json_encode([
'State' => 2,
'State' => 4,
'ActiveChargingPower' => 11.0,
'MaxAllowedChargingCurrent' => 16,
'MaxStationCurrent' => 16,
'LastSeen' => gmdate('Y-m-d\TH:i:s\Z'),
'ValueDate' => gmdate('Y-m-d\TH:i:s\Z'),
], JSON_THROW_ON_ERROR),
'Phasenzahl' => 3,
'BefehlUrlTeil' => 'current=16000',
@@ -452,9 +454,9 @@ return static function (TestContext $test): void {
));
});
$test->runCase('Neue Ladestation wird erst nach Freigabe mit Mindeststrom erkannt', static function (
$test->runCase('Phasenprobe braucht Managerbudget und deutet Nullleistung nicht als einphasig', static function (
TestContext $test
) use ($phasenerkennung, $anforderungSenden): void {
) use ($phasenerkennung, $anforderungSenden, $goEAntwort): void {
$stationId = $phasenerkennung;
$test->assertSame(
0,
@@ -471,13 +473,23 @@ return static function (TestContext $test): void {
0,
GetValue($test->objectByIdent('Phasenzahl', $stationId))
);
$test->assertSame('[0,4104]', GetValue($test->objectByIdent('LeistungsangebotDiagnose', $stationId)));
$test->assertTrue(!str_contains(
(string) GetValue($test->objectByIdent('LetzterGeraetebefehl', $stationId)),
'amp=6'
), 'Die Freigabe allein ersetzt kein Managerbudget.');
$anforderungSenden($stationId, 4104);
$test->assertTrue(str_contains(
(string) GetValue($test->objectByIdent('LetzterGeraetebefehl', $stationId)),
'amp=6'
), 'Nach der Freigabe muss die Mindeststrom-Phasenprobe starten.');
), 'Nach Freigabe und Budget muss die Mindeststrom-Phasenprobe starten.');
IPS_Sleep(2100);
IPS_RequestAction($stationId, 'Statuszyklus', false);
$test->assertSame(0, GetValue($test->objectByIdent('Phasenzahl', $stationId)));
$test->assertSame(false, GetValue($test->objectByIdent('FahrzeugGeladen', $stationId)));
IPS_SetProperty($stationId, 'Testantwort', $goEAntwort(2, 1380, [6, 0, 0]));
IPS_ApplyChanges($stationId);
$anforderungSenden($stationId, 3680);
IPS_RequestAction($stationId, 'Statuszyklus', false);