Repository navigation
feat(fetch): warn when export_more_solar is enabled but has no effect - #5226
Merged
Merged
Conversation
…t_freeze export_more_solar works by enabling Freeze Export on otherwise-idle slots that have predicted solar, so optimise_solar() returns immediately when set_export_freeze is off. The switch is then on but does nothing at all, with no indication anywhere - a system in #4865 had run that combination for months without knowing. Warn once per incident rather than every cycle, since fetch_config_options() runs every ~5 minutes and the combination may be deliberate. The flag resets when the combination becomes valid again so a later recurrence is reported. Mirrors the existing car_charging_energy_warned handling in the same function. The docs already stated the dependency; they now also mention the warning. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The warning must also cover inverter configurations where Freeze Export support is unavailable.
Review effort: Lite
Findings: None
What changed in this PR
Adds a throttled warning when export_more_solar is enabled without effective Freeze Export support, with documentation and regression tests.
Changes:
- Adds once-per-incident warning state and logging.
- Documents the ineffective configuration.
- Adds tests for no-op behavior, throttling, reset, and valid combinations.
| File | Summary |
|---|---|
docs/customisation.md |
Documents the warning behavior. |
apps/predbat/unit_test.py |
Registers the new tests. |
apps/predbat/tests/test_export_more_solar_warning.py |
Tests warning and reset behavior. |
apps/predbat/predbat.py |
Initializes warning state. |
apps/predbat/fetch.py |
Emits the configuration warning; currently misses cases where inverter discovery disables Freeze Export. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…, not just the switch The check read set_export_freeze in fetch_config_options(), before fetch_inverter_data() forces it off for an inverter without freeze support, so that case never warned. It also missed calculate_best_export being off (mode not Control charge & discharge), which short-circuits optimise_solar() the same way. Move the check to check_export_more_solar_effective(), run from update_pred() right after the first successful fetch_inverter_data(), and name the actual cause: mode, an unsupported inverter (asked of the inverter, so the user is never told to enable a switch that would change nothing), or the switch. Track the reason rather than a bool so fixing one cause while another remains warns again instead of going quiet. The premise test now swaps prediction for an object that raises on use, with a positive control, so it tests the guard rather than leftover fixture state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This PR was written by Claude.
Problem
export_more_solarworks by enabling Freeze Export on otherwise-idle slots that have predicted solar generation, sooptimise_solar()returns immediately unless export slots are being planned and Freeze Export is available:The switch is then on but does nothing whatsoever, and nothing anywhere says so. This turned up while investigating #4865 - a user had been running that combination for months, reasonably assuming the setting was doing something.
Change
Warn when
export_more_solaris enabled but cannot have any effect, naming the cause:calculate_best_exportis off), so export slots are not plannedfetch_inverter_data()forcesset_export_freezeoff whatever the switch says, so the user is told to turnexport_more_solaroff rather than to enable a switch that would change nothingset_export_freezeis offThe check is
check_export_more_solar_effective(), run fromupdate_pred()right after the first successfulfetch_inverter_data(). It cannot live infetch_config_options(): that runs before the inverter-capability override, so an unsupported inverter would never be caught.Logged once per incident rather than every cycle, since the combination may well be deliberate. The last reason is tracked rather than a bool, so fixing one cause while another remains warns again instead of going quiet; it re-arms once
export_more_solaris effective, so a later recurrence is reported.docs/customisation.mdalready stated the dependency; it now also lists the three cases that warn.Testing
test_export_more_solar_warning.py, five tests:optimise_solar()really is a no-op in each warned state -predictionis swapped for an object that raises on use, with a positive control for the effective case, so the guard itself is tested rather than whatever an earlier test left in the shared fixtureset_export_freeze(including when the switch is also off)export_more_solaroff, or fully effective, never warnsMutation-tested: reading the configured switch instead of the effective value, reverting to a bool flag, and removing the
optimise_solar()guard each fail the suite../run_all --quickgreen./run_pre_commitgreenNote
This is only the discoverability half. The related finding from #4865 - that Freeze Export causes clipping on inverters without
support_feedin_first(e.g. Sigenergy), so enabling it can be actively counterproductive there - would need its own warning and is not included here.