Fix: active_power Vorzeichen final korrekt (positiv = Einspeisung)

Goodwe ET Bibliothek: house_consumption = ppv + pbattery1 - active_power
→ active_power > 0 = Einspeisung (Überschuss), < 0 = Netzbezug.
Falsches Vorzeichen erzeugte Rückkopplungsschleife: mehr Bezug → mehr
scheinbarer Überschuss → noch mehr Laden.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
retr0
2026-04-28 13:08:12 +02:00
parent 511cd30182
commit ad89e1bc56
+3 -2
View File
@@ -155,9 +155,10 @@ def _get_pv_surplus() -> float:
if not d.get("modbus_ok") or not d.get("values"): if not d.get("modbus_ok") or not d.get("values"):
continue continue
v = d["values"] v = d["values"]
# Goodwe ET: active_power < 0 bedeutet Einspeisung ins Netz # Goodwe ET: active_power > 0 = Einspeisung, < 0 = Netzbezug
# house_consumption = ppv + pbattery1 - active_power (Bibliotheks-Formel)
if "active_power" in v: if "active_power" in v:
surplus += max(0.0, -v["active_power"]) surplus += max(0.0, v["active_power"])
# Growatt # Growatt
if "power_to_grid" in v: if "power_to_grid" in v:
surplus += max(0.0, v["power_to_grid"]) surplus += max(0.0, v["power_to_grid"])