feat(batterie): stufenlose Leistungsbereiche unterstützen
Tests / test (push) Successful in 49s

This commit is contained in:
dh
2026-09-27 08:46:17 +00:00
parent 72d96aeb81
commit f47c908798
10 changed files with 132 additions and 91 deletions
+10 -9
View File
@@ -293,10 +293,9 @@ class Batterie extends IPSModule implements VerbraucherSchnittstelle
$sollleistung = $daten['Sollleistung_W'];
if ($sollleistung === null) {
if ((bool) $this->leseZustand('SollwertGueltig')
&& !in_array(
(int) $this->leseZustand('Sollleistung'),
&& !Nachrichtenvertrag::enthaeltLeistungswert(
$this->leseLeistungsangebot(),
true
(int) $this->leseZustand('Sollleistung')
)
) {
$this->setzeZustand('SollwertGueltig', false);
@@ -306,7 +305,10 @@ class Batterie extends IPSModule implements VerbraucherSchnittstelle
return;
}
if (!in_array($sollleistung, $this->leseLeistungsangebot(), true)) {
if (!Nachrichtenvertrag::enthaeltLeistungswert(
$this->leseLeistungsangebot(),
$sollleistung
)) {
throw new InvalidArgumentException(
'Sollleistung_W liegt nicht im aktuell gemeldeten Leistungsangebot.'
);
@@ -394,10 +396,9 @@ class Batterie extends IPSModule implements VerbraucherSchnittstelle
);
if ((bool) $this->leseZustand('SollwertGueltig')
&& !in_array(
(int) $this->leseZustand('Sollleistung'),
&& !Nachrichtenvertrag::enthaeltLeistungswert(
$angebot,
true
(int) $this->leseZustand('Sollleistung')
)
) {
$this->setzeZustand('SollwertGueltig', false);
@@ -1073,7 +1074,7 @@ class Batterie extends IPSModule implements VerbraucherSchnittstelle
}
}
/** @return list<int> */
/** @return list<int|array{Von_W: int, Bis_W: int}> */
private function leseLeistungsangebot(): array
{
$angebot = json_decode(
@@ -1086,7 +1087,7 @@ class Batterie extends IPSModule implements VerbraucherSchnittstelle
return [0];
}
return array_values(array_map('intval', $angebot));
return array_values($angebot);
}
private function setzeStoerung(string $text): void