Branch 4: BA81 GEN cutoff audit + exekuce při sell<0
Some checks failed
CI and deploy / migration-check (push) Failing after 14s
CI and deploy / deploy (push) Has been skipped

This commit is contained in:
Dusan Vojacek
2026-06-06 22:36:27 +02:00
parent a7879f1141
commit 0f7dc6ed94
11 changed files with 99 additions and 4 deletions

View File

@@ -93,6 +93,27 @@ def _deye_reg178_verify_match(expected_i: int, actual_i: int) -> bool:
)
def deye_mi_export_cutoff_want_enabled(
*,
gen_microinverter_cutoff_enabled: bool,
deye_gen_cutoff_enabled: bool,
export_ban: bool,
deye_mode: str,
) -> bool:
"""
True = zapnout MI export cut-off (reg 178 bits 01 = 11b).
Plán může mít z_gen_cutoff=0 (PV B jen do domu v LP), ale bez cut-off na GEN portu
mikroinvertory fyzicky exportují do sítě — při export_ban (záporná vykupní, grid≥0)
cut-off vynutit i bez solver flagu.
"""
if not gen_microinverter_cutoff_enabled:
return False
if deye_mode == "SELL":
return False
return bool(deye_gen_cutoff_enabled) or bool(export_ban)
def deye_reg_triggers_self_sustain_after_verify_exhaust(reg: int) -> bool:
"""True = po 3x mismatch přepnout lokalitu do SELF_SUSTAIN (kritický registr)."""
return int(reg) in DEYE_CRITICAL_REGS_SELF_SUSTAIN