Force PASSIVE/no-export when sell is negative or export_mode is NONE, and alert NEG_SELL_EXPORT in plan_actual_slot_guard when export still occurs. Co-authored-by: Cursor <cursoragent@cursor.com>
82 lines
2.6 KiB
Python
82 lines
2.6 KiB
Python
"""Zpětně kompatibilní fasáda pro původní control exporter importy."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from services.control.deye_helpers import (
|
|
BATT_VOLTAGE_V,
|
|
DEYE_CLOCK_DRIFT_OK_SEC,
|
|
DEYE_CLOCK_REGS,
|
|
DEYE_CLOCK_RESYNC_INTERVAL_HOURS,
|
|
DEYE_CLOCK_VERIFY_MAX_DELTA_SEC, # noqa: F401 - re-export for compatibility
|
|
DEYE_CRITICAL_REGS_SELF_SUSTAIN, # noqa: F401 - re-export for compatibility
|
|
DEYE_REGISTER_NAMES, # noqa: F401 - re-export for compatibility
|
|
DEYE_TOU_INACTIVE_HHMM,
|
|
DEYE_TOU_POWER_REGS,
|
|
PRAGUE_TZ,
|
|
REG178_MI_EXPORT_DISABLE,
|
|
REG178_MI_EXPORT_ENABLE,
|
|
REG178_MI_EXPORT_MASK,
|
|
REG178_PASSIVE,
|
|
REG178_SELL,
|
|
REG178_VERIFY_MASK,
|
|
REG178_VERIFY_MASK_COMBINED,
|
|
_DEYE_INACTIVE_TOU_REGISTERS,
|
|
_deye_clock_registers_verify_match,
|
|
_deye_reg178_verify_match,
|
|
_deye_reg178_verify_with_double_read,
|
|
_deye_registers_to_prague_datetime, # noqa: F401 - re-export for compatibility
|
|
_deye_should_skip_time_sync_after_read,
|
|
_deye_tou_power_verify_match,
|
|
_prague_minute_start_utc,
|
|
battery_watts_to_amps,
|
|
compute_pv_a_reg340_max_solar_w,
|
|
current_slot_hhmm,
|
|
deye_reg_triggers_self_sustain_after_verify_exhaust, # noqa: F401 - re-export
|
|
next_slot_hhmm,
|
|
watts_to_amps,
|
|
)
|
|
from services.control.inverter import read_deye_registers_live, write_inverter_setpoints
|
|
from services.control.models import ControlSetpoints, InverterConfig, OperatingModeInfo
|
|
from services.control.modbus_journal import (
|
|
_drop_registers_matching_last_verified,
|
|
_fetch_last_verified_inverter_registers,
|
|
create_modbus_commands,
|
|
execute_modbus_commands,
|
|
)
|
|
from services.control.outputs import (
|
|
_current_limit_for_charger,
|
|
send_loxone_setpoints,
|
|
write_ev_setpoints,
|
|
write_heat_pump_setpoint,
|
|
)
|
|
from services.control.orchestrator import export_setpoints
|
|
from services.control.repository import (
|
|
_fetch_max_charge_power_w,
|
|
_fetch_operating_mode,
|
|
_fetch_plan_row_for_slot_offset,
|
|
_get_current_soc,
|
|
_load_inverter_config,
|
|
)
|
|
from services.control.setpoints import (
|
|
_DictRecord,
|
|
_apply_export_plan_guard,
|
|
_apply_price_failsafe_guard,
|
|
_build_setpoints,
|
|
_clamp_deye_tou_soc_pct,
|
|
_deye_passive_tou_battery_soc_pct,
|
|
_deye_reg143_export_w,
|
|
_deye_system_time_register_rows,
|
|
_deye_time_point_rows,
|
|
_deye_tou_min_soc_pct,
|
|
_deye_tou_params,
|
|
_deye_tou_reserve_soc_pct,
|
|
get_deye_mode,
|
|
)
|
|
from services.control.verify import (
|
|
_deye_expected_clock_triplet_for_verify,
|
|
_modbus_cmd_register,
|
|
_switch_to_self_sustain,
|
|
_verify_deye_clock_written_bundle,
|
|
verify_modbus_commands,
|
|
)
|