Fix review feedback: clean up imports, restore tests, fix charge rate bounds logic, remove MQTT retain#292
Conversation
…x bounds logic, remove retain Co-authored-by: MaStr <1036501+MaStr@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
Please move the guard against the min_max problems in the initialization area, assuming that these values are non changable parameters from the config file @copilot |
Co-authored-by: MaStr <1036501+MaStr@users.noreply.github.com>
Done in commit Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
* feat: Implement limit battery charge rate functionality - Added `min_pv_charge_rate` and `max_pv_charge_rate` to inverter configuration. - Introduced `MODE_LIMIT_BATTERY_CHARGE_RATE` to allow limiting PV charging while permitting battery discharge. - Updated `Batcontrol` class to handle new charge rate limits and modes. - Implemented `limit_battery_charge_rate` method in `Batcontrol` to apply dynamic limits based on configuration. - Enhanced `Dummy` and `FroniusWR` inverter classes to support the new limit battery charge mode. - Updated MQTT publishing to include commands for setting battery charge limits. - Added unit tests for the new functionality, including edge cases for charge limits. * Enhance reslient wrapper * fix: Address PR #260 review feedback - Add assertions to test_production_offset_applied_to_forecast to verify that last_production[1] and [2] reflect the 50% offset, and remove misplaced test logic that was left over from deleted test methods - Add warning log in api_set_mode when MODE_LIMIT_BATTERY_CHARGE_RATE is used but _limit_battery_charge_rate is still -1 (no limit set), so callers are informed about the silent fallback to allow-discharging - Remove extra blank line at end of tests/batcontrol/inverter/test_fronius_ids.py - Remove unused Mock import from tests/batcontrol/test_core.py Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: Correct swapped docstrings in InverterInterface set_mode_avoid_discharge was documented as 'allow discharge mode' and set_mode_allow_discharge was documented as 'avoid discharge mode'. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs: Clarify min_pv_charge_rate comment in config The previous comment implied that setting min_pv_charge_rate to 0 was needed to allow complete charge blocking. In reality, the implementation skips the minimum floor when limit_charge_rate == 0, so a requested limit of 0 always results in complete charge blocking regardless of min_pv_charge_rate. The comment now reflects this actual behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix review feedback: clean up imports, restore tests, fix charge rate bounds logic, remove MQTT retain (#292) * Initial plan * fix: Address PR review feedback - clean up imports, restore tests, fix bounds logic, remove retain Co-authored-by: MaStr <1036501+MaStr@users.noreply.github.com> * refactor: Move min/max PV charge rate guard to initialization Co-authored-by: MaStr <1036501+MaStr@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: MaStr <1036501+MaStr@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: MaStr <1036501+MaStr@users.noreply.github.com>
sys.pathmanipulation and unused imports intests/batcontrol/test_core.pyapi_set_production_offset(valid value 0.7 and negative invalid value) intests/batcontrol/test_production_offset.pycore.pylimit_battery_charge_rateto properly handlemin_pv_charge_rate > max_pv_charge_rateretain=Truefrompublish_limit_battery_charge_rateinmqtt_api.pymin_pv_charge_rate > max_pv_charge_rateguard into__init__()(fires warning once at startup, clampsself.min_pv_charge_ratesolimit_battery_charge_rate()can rely on the invariant)max_pv_charge_ratefromconfig['inverter']first (with inverter attribute as fallback) to avoid MagicMock comparison issues in tests💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.