feat(forecast): integrate full forecast charts and complete SDL visualization
Tests / test (push) Failing after 52s

This commit is contained in:
dh
2026-10-06 17:40:45 +00:00
parent 5687596799
commit 372b997876
30 changed files with 4377 additions and 53 deletions
+62
View File
@@ -386,6 +386,68 @@ final class ManagerSDLTest extends TestCase
}
}
public function testEnergyPieAttributionTracksSDLWithoutChangingCustomSettings(): void
{
$custom = [
'ProduktionZaehlerID' => 801,
'NetzbezugZaehlerID' => 802,
'EinspeisungZaehlerID' => 803,
'VerbrauchZaehlerID' => 804,
'FarbeEigenverbrauch' => '#123456',
'FarbeAutarkie' => '#ABCDEF',
'Standardzeitraum' => 'month',
'EnergieanteileBerechenbar' => true,
];
ManagerSDLRuntime::$properties[303] = $custom;
$this->properties(['SDLAktiv' => true]);
$this->invoke('synchronisiereEnergyPieAnteile', [303]);
self::assertSame(array_replace($custom, ['EnergieanteileBerechenbar' => false]),
ManagerSDLRuntime::$properties[303]);
$writes = ManagerSDLRuntime::$writes;
$this->invoke('synchronisiereEnergyPieAnteile', [303]);
self::assertSame($writes, ManagerSDLRuntime::$writes);
$this->properties(['SDLAktiv' => false]);
$this->invoke('synchronisiereEnergyPieAnteile', [303]);
self::assertSame($custom, ManagerSDLRuntime::$properties[303]);
}
public function testOlderEnergyPieStaysVisibleWithoutSDLAndKeepsConfiguration(): void
{
$custom = ['ProduktionZaehlerID' => 801, 'FarbeEigenverbrauch' => '#123456'];
ManagerSDLRuntime::$properties[303] = $custom;
$this->properties(['SDLAktiv' => false]);
$this->invoke('synchronisiereEnergyPieAnteile', [303]);
self::assertSame($custom, ManagerSDLRuntime::$properties[303]);
self::assertFalse(ManagerSDLRuntime::$hidden[303]);
self::assertSame([], ManagerSDLRuntime::$logs);
}
public function testOlderEnergyPieIsHiddenWithSDLAndRestoredAfterUtilsUpdate(): void
{
$custom = ['ProduktionZaehlerID' => 801, 'FarbeEigenverbrauch' => '#123456'];
ManagerSDLRuntime::$properties[303] = $custom;
$this->properties(['SDLAktiv' => true]);
$this->invoke('synchronisiereEnergyPieAnteile', [303]);
self::assertSame($custom, ManagerSDLRuntime::$properties[303]);
self::assertTrue(ManagerSDLRuntime::$hidden[303]);
self::assertCount(1, ManagerSDLRuntime::$logs);
self::assertStringContainsString('Enelix Utils aktualisieren', ManagerSDLRuntime::$logs[0][1]);
ManagerSDLRuntime::$properties[303]['EnergieanteileBerechenbar'] = true;
$this->invoke('synchronisiereEnergyPieAnteile', [303]);
self::assertFalse(ManagerSDLRuntime::$hidden[303]);
self::assertSame(array_replace($custom, ['EnergieanteileBerechenbar' => false]),
ManagerSDLRuntime::$properties[303]);
self::assertCount(1, ManagerSDLRuntime::$logs);
}
private function advanceCounters(): void
{
foreach ([201 => 102.0, 202 => 11.0, 203 => 5.2, 204 => 10.4, 205 => 8.1] as $id => $value) {
+11
View File
@@ -36,6 +36,17 @@ function fields(array $form): array
throw new RuntimeException('Forecast panel missing');
}
$anzeigen = ManagerPrognoseFormular::laufzeitAnzeige();
check(count($anzeigen) === 4, 'only known forecast runtime objects are consolidated');
foreach ($anzeigen as $ident => $name) {
check(str_starts_with($ident, 'NetzfahrplanV4'), 'stable existing identifier retained');
check(!str_contains($name, 'V4'), 'technical version removed from display name');
}
check(str_contains($anzeigen['NetzfahrplanV4Aktivtest'], 'Testbetrieb'), 'test limitation remains visible');
$module = file_get_contents(__DIR__ . '/../../Manager/module.php');
check(str_contains($module, 'ManagerPrognoseFormular::laufzeitAnzeige()'), 'runtime display migration is applied');
check(str_contains($module, 'IPS_SetHidden($objektID, true)'), 'legacy diagnostics are hidden, not deleted');
$base = json_decode(file_get_contents(__DIR__ . '/../../Manager/form.json'), true, 512, JSON_THROW_ON_ERROR);
$state = [
'prognoseAktiv' => true, 'lizenziert' => true, 'senderAktiv' => true, 'empfangAktiv' => true,
+12
View File
@@ -11,6 +11,7 @@ final class ManagerSDLRuntime
public static array $media = [];
public static array $writes = [];
public static array $hidden = [];
public static array $logs = [];
private static int $nextID = 10000;
public static function reset(): void
@@ -21,6 +22,7 @@ final class ManagerSDLRuntime
self::$media = [];
self::$writes = [];
self::$hidden = [];
self::$logs = [];
self::$nextID = 10000;
}
@@ -145,6 +147,16 @@ function IPS_GetProperty(int $instanceID, string $property)
return ManagerSDLRuntime::$properties[$instanceID][$property];
}
function IPS_GetConfiguration(int $instanceID): string
{
return json_encode(ManagerSDLRuntime::$properties[$instanceID] ?? [], JSON_THROW_ON_ERROR);
}
function IPS_LogMessage(string $sender, string $message): void
{
ManagerSDLRuntime::$logs[] = [$sender, $message];
}
function IPS_SetProperty(int $instanceID, string $property, $value): void
{
ManagerSDLRuntime::$properties[$instanceID][$property] = $value;