Repository navigation
fix(gecloud): stop deleting a manual inverter_mode override during automatic config (#5056) - #5059
Merged
springfall2008 merged 1 commit intoSep 11, 2026
Conversation
…tomatic config
async_automatic_config() called set_arg("inverter_mode", None) whenever no
enable_eco_mode register was found, which deletes any value the user had set
in apps.yaml on every config refresh. Switch to set_arg_auto(..., overwrite=False),
the same pattern already used for export_limit (springfall2008#4494/springfall2008#4500, springfall2008#4978), so a manual
override survives instead of being silently wiped.
Adds a test case that actually exercises the overwrite=False path by seeding
args_from_apps_yaml, closing the coverage gap a bot triage review flagged in the
existing test.
Fixes springfall2008#5056
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved blocking issues were identified.
Pull request overview
This PR preserves manually configured inverter_mode values during GE Cloud automatic configuration.
Changes:
- Uses
set_arg_auto(..., overwrite=False). - Adds regression coverage for manual override preservation.
File summaries
| File | Description |
|---|---|
apps/predbat/tests/test_ge_cloud.py |
Tests that manual overrides survive automatic configuration. |
apps/predbat/gecloud.py |
Preserves explicit inverter_mode values. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Fixes #5056
Summary
On GE Cloud devices where the automatic register scan finds no matching entity for
inverter_mode(noenable_eco_moderegister on this hardware class),async_automatic_config()calledself.set_arg("inverter_mode", None).set_arg()treatsNoneas "delete this key," so any value the user had explicitly set forinverter_modeinapps.yamlwas deleted on every config refresh whilege_cloud_automatic: true— with no way to work around it fromapps.yaml, since the key was gone again beforeadjust_inverter_mode()ever got a chance to read it.This is exactly the class of problem
export_limitalready solves a few lines later in the same function:set_arg_auto(..., overwrite=False)(added for #4494 / PR #4500, and used again for site export limits in #4978) fills a key in when the user has set nothing, but leaves an explicit apps.yaml value alone rather than deleting it.inverter_modehad just never been switched over to it.Fix
Scoped to
inverter_modeonly — the otherset_arg(key, build_entities(...))call sites in this function (charge_rate,discharge_rate,reserve,charge_limit,scheduled_charge_enable, etc.) have the same delete-on-Nonebehaviour but aren't part of this issue, per the reporter's own framing.Testing
A GitHub bot triage review of the issue flagged that the existing coverage at
test_ge_cloud.py:4164(assertinginverter_modeisNonewhen the eco toggle is absent) only passed because that assertion can't distinguish "key never set" from "key deleted" — it never actually populatedargs_from_apps_yamlwith a manual value, so it never exercisedset_arg_auto'soverwrite=Falsebranch for this key at all. Added a new case to_test_async_automatic_configthat seeds bothconfig_args["inverter_mode"]and (critically)base.args_from_apps_yaml["inverter_mode"]with a manually-configured entity, then runs auto-config against a device with no eco-mode register, and asserts the manual value survives.tools/triage_test.sh ge_cloud: all passing, including the new case — verified red on the unfixed code and green on the fix. The new case is an added assertion inside the existingautomatic_configtest function rather than a separately-registered test, so the total stays at 94 either way (Predbat's suite counts registered test functions, not individual assertions); what changes is whether that function passes. Confirmed the wiring directly: reverting just the one-linegecloud.pychange while keeping the new test flipsautomatic_configto failing (EXCEPTION in automatic_config: manually configured inverter_mode should survive auto-config when no eco toggle switch is discovered, 93 passed / 1 failed of 94); restoring the fix returns it to 94 passed, 0 failed.run_pre_commit(pre-commit run --all-files+./run_all --quick): passing aside from four pre-existing failures unrelated to gecloud — two Windows-specific environment issues (apathlibcrash intools/triage_daemon.py, and actypes/glibcLoadLibrary(None)bug hit by two unrelated tests) and a missing compiled prediction kernel causing two golden-baseline tests to drift onto the slower Python fallback engine — all four reproducing identically on unmodifiedmain. With those excluded, the remaining 306 quick tests pass.Related
enable_eco_moderegister on some 3-phase GEC hardware, soinverter_modecan now be supplied manually and will actually stick.🤖 Generated with Claude Code