refactor export limit semantics
Some checks failed
CI and deploy / migration-check (pull_request) Failing after 15s
CI and deploy / deploy (pull_request) Has been skipped

This commit is contained in:
Dusan Vojacek
2026-05-03 22:24:35 +02:00
parent 349a15e96a
commit e8eb867a2a
16 changed files with 134 additions and 17 deletions

View File

@@ -178,6 +178,10 @@ async def compute_export_ban_active(site_id: int, conn: asyncpg.Connection) -> b
if bool(pi.get("is_predicted_price")):
return True
export_mode = str(pi.get("export_mode") or "").upper()
if export_mode in ("PV_SURPLUS", "BATTERY_SELL"):
return False
sell_raw = pi.get("effective_sell_price")
grid_sp = int(pi.get("grid_setpoint_w") or 0)
if sell_raw is None: