75 lines
2.4 KiB
Python
75 lines
2.4 KiB
Python
"""Datové modely pro control export."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
from datetime import date, datetime
|
|
|
|
|
|
@dataclass
|
|
class InverterConfig:
|
|
id: int
|
|
code: str
|
|
host: str
|
|
port: int
|
|
unit_id: int
|
|
max_export_power_w: int | None
|
|
max_import_power_w: int | None
|
|
no_export: bool
|
|
max_battery_charge_w: int | None
|
|
max_battery_discharge_w: int | None
|
|
min_soc_percent: int | None
|
|
reserve_soc_percent: int | None
|
|
max_soc_percent: int | None
|
|
usable_capacity_wh: int | None
|
|
max_charge_a: int
|
|
max_discharge_a: int
|
|
deye_last_system_time_sync_minute: datetime | None = None
|
|
deye_last_system_time_sync_at: datetime | None = None
|
|
deye_last_tou_inactive_write_prague_date: date | None = None
|
|
deye_tou_inactive_signature: str | None = None
|
|
deye_zero_export_mode: int = 1
|
|
deye_gen_microinverter_cutoff_enabled: bool = False
|
|
#: Součet nominal_power_wp controllable PV na invertoru; 0 = EMS nezapisuje reg 340.
|
|
pv_a_cap_w: int = 0
|
|
#: True = EMS smí řídit Deye reg 340 (max solar power); z SQL `fn_site_has_active_green_bonus_pv(site_id)`.
|
|
deye_reg340_pv_a_control_enabled: bool = False
|
|
|
|
|
|
@dataclass
|
|
class ControlSetpoints:
|
|
battery_w: int | None
|
|
#: Tvrdý limit exportu do sítě v daném slotu (W), ne forecastová cílová hodnota.
|
|
grid_export_limit: int
|
|
ev1_current_a: int
|
|
ev2_current_a: int
|
|
heat_pump_enable: bool
|
|
grid_setpoint_w: int
|
|
ev1_power_w: int
|
|
ev2_power_w: int
|
|
target_soc_pct: int | None = None
|
|
#: Explicitní fyzický režim z plánu (PASSIVE/SELL/CHARGE).
|
|
deye_physical_mode: str | None = None
|
|
#: True = zákaz exportu (BLOCK_EXPORT) pro daný slot.
|
|
export_ban: bool = False
|
|
#: True = odpojit GEN port (MI export cutoff) v tomto slotu dle plánu (reg 178 bits0-1).
|
|
deye_gen_cutoff_enabled: bool = False
|
|
#: Efektivní vykupní cena slotu (Kč/kWh z plánu).
|
|
effective_sell_price_czk_kwh: float | None = None
|
|
#: True = reg 108/109 na 0 (PRESERVE - Deye baterii nepoužívá).
|
|
lock_battery: bool = False
|
|
#: Režim SELF_SUSTAIN.
|
|
self_sustain_local_use: bool = False
|
|
#: Deye reg 340 (max solar power, W). None = EMS reg 340 v tomto ticku neřeší.
|
|
pv_a_allowed_w: int | None = None
|
|
|
|
|
|
@dataclass
|
|
class OperatingModeInfo:
|
|
mode_code: str
|
|
battery_mode: str
|
|
grid_mode: str
|
|
ev_enabled: bool
|
|
heat_pump_enabled_def: bool
|
|
loxone_mode_value: int
|