Repository navigation
Fix validation error when battery_charge/discharge_power_curve is set to "auto" - #3728
Merged
Merged
Conversation
…dation Agent-Logs-Url: https://github.com/springfall2008/batpred/sessions/dae4c313-edf9-4c90-a5a6-a616b1bfa7fb Co-authored-by: springfall2008 <48591903+springfall2008@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix auto charge and discharge error in apps.yaml
Fix validation error when battery_charge/discharge_power_curve is set to "auto"
Apr 3, 2026
springfall2008
marked this pull request as ready for review
April 3, 2026 12:48
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a config validation mismatch where battery_charge_power_curve: auto / battery_discharge_power_curve: auto are valid runtime values (triggering auto-detection), but previously failed schema validation.
Changes:
- Allow
"auto"as an alternative toint_float_dictfor the two battery power curve config keys via a schema flag. - Extend
validate_config()’sint_float_dictvalidation to accept"auto"when explicitly enabled by the schema. - Add a regression test ensuring both curve settings can be set to
"auto"without increasing validation errors.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/predbat/config.py | Marks both battery power curve config keys as allowing "auto" during validation. |
| apps/predbat/predbat.py | Updates int_float_dict validation to accept "auto" when spec["or_auto"] is set. |
| apps/predbat/tests/test_battery_curve_keys.py | Adds a test to prevent regressions for "auto" curve validation. |
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.
Setting
battery_charge_power_curve: autoorbattery_discharge_power_curve: autoinapps.yamltriggers validation errors because the schema only permitsint_float_dict, despite"auto"being a valid runtime value that enables auto-detection.Changes
config.py: Added"or_auto": Trueto the APPS_SCHEMA entries for bothbattery_charge_power_curveandbattery_discharge_power_curvepredbat.py: Updatedint_float_dictvalidation to accept"auto"whenor_autois set in the spectests/test_battery_curve_keys.py: Addedtest_validate_config_auto_curveto assert that setting both curves to"auto"introduces no additional validation errorsWarning
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:
api.octopus.energy/home/REDACTED/work/batpred/batpred/coverage/venv/bin/python3 python3 ../apps/predbat/unit_test.py --quick git conf�� unset --global d/coverage/venv/bin/lsb_release user.name(dns block)gitlab.com/usr/lib/git-core/git-remote-https /usr/lib/git-core/git-remote-https origin REDACTED(dns block)https://api.github.com/repos/springfall2008/batpred/contents/apps/predbat/home/REDACTED/work/batpred/batpred/coverage/venv/bin/python3 python3 ../apps/predbat/unit_test.py --quick --test validate_config(http block)/home/REDACTED/work/batpred/batpred/coverage/venv/bin/python3 python3 ../apps/predbat/unit_test.py --list(http block)/home/REDACTED/work/batpred/batpred/coverage/venv/bin/python3 python3 ../apps/predbat/unit_test.py --quick --test fetch_config_options(http block)If you need me to access, download, or install something from one of these locations, you can either: