Update to upstream v8.40.10 while preserving FIT payments#6
Merged
Conversation
…ed into fix/crash_load_zero
…load_zero Fix load so far crash
…red into feat/sigenergy_cloud
Preserve manual DoD/usable config when battery_scaling_auto is enabled by introducing battery_scaling_config and clamping auto-scaling to [config*0.8, config]. Update Inverter to set battery_scaling from the computed value and to default battery_scaling to 1.0 when no nominal capacity is configured. Add/adjust unit tests: helper _clamped_auto_scaling, assert battery_scaling is updated in existing auto-scaling tests, add test_battery_scaling_auto_preserves_configured_scaling to ensure measured degradation below configured DoD is applied, and wire the new test into the test runner.
Update Sig Energy service calls in inverter setup documentation
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Fix: Tesla Powerwall setup instructions and example
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Reset GECloud defaults after 24 hours, Add 100w base load default, catch crash with MinuteData array
…-token-size Fix: Tesla access token field size
Revise Huawei inverter setup in documentation
…expired JWT
The gateway MQTT access token is a short-lived (24h) JWT. When it expired,
_mqtt_loop reconnected forever with the same rejected token — the broker
returns CONNACK code 134 ("Bad user name or password") on every attempt — so
PredBat silently lost all gateway control until the pod/config was rebuilt.
The proactive near-expiry refresh in _check_token_refresh runs from the
housekeeping loop, which does not help once the listener is stuck reconnecting.
Make the reconnect loop self-healing: on a broker auth-failure it now forces a
token refresh before retrying, instead of looping on the dead token.
- _is_auth_failure(): classify CONNACK 134/135 auth rejections vs ordinary drops
- _maybe_refresh_on_auth_error(): force a refresh only for auth failures
- _do_token_refresh() / _apply_refresh_response(): extracted from
_check_token_refresh so the proactive and reconnect paths share one refresh
- wired into _mqtt_loop's exception handler
Adds test_gateway_token_refresh.py (12 tests); existing gateway tests stay green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… on load When a cached model is loaded at startup, last_train_time was left None, causing the training-age check to treat the model as infinitely old and force an immediate retrain. Use predictor.training_timestamp (already restored from the .npz metadata by LoadPredictor.load) rather than the filesystem mtime, which can be wrong after file copies or backup restores. If training_timestamp is None (pre-dating that field), last_train_time stays None and a retrain correctly triggers as a safe fallback. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rain_time fix(ml): set last_train_time from model's embedded training_timestamp on load
…y-mqtt-token-refresh-on-auth fix(gateway): refresh MQTT token on broker auth-failure to self-heal expired JWT
Fix GECloud and standalone PV, Fox cache updates
…olemy-dyws88 # Conflicts: # apps/predbat/unit_test.py
- Resolve unit_test.py conflict keeping both FIT and storage test registration - Declare expected clipping (assert_clipped=36) in FIT clipping tests, now that upstream's simple_scenario asserts total clipping - Default FIT income to 0 via getattr in calculate_yesterday so the mocked run_prediction path in test_calculate_yesterday no longer raises Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139MJfnebYZdxUEntj7FFMg
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.
Summary
Merges the latest build from upstream
springfall2008/batpred(now v8.40.10, ~581 commits ahead of our previous base of v8.36.3) into the fork, while keeping the full Feed-in Tariff (FIT) payment feature intact.What changed
upstream/main(v8.40.10) into the branch. The auto-merge cleanly carried the FIT code inconfig.py,fetch.py,prediction.py,plan.py,output.py,tests/test_fit.py,tests/test_infra.pyandCLAUDE.md.unit_test.py, keeping both the FIT test registration and upstream's newstoragetest registration.simple_scenarionow asserts total PV clipping. The two FIT clipping scenarios deliberately clip ~36 kWh, so they now declareassert_clipped=36.calculate_yesterday: FIT income is now read withgetattr(..., 0)so the upstreamtest_calculate_yesterdaypath (which mocksrun_predictionand never sets the FIT attributes) no longer raises, and FIT income correctly defaults to 0 when FIT is disabled or the prediction wasn't saved.Verification
./run_all --test fit→ PASSED (all 6 FIT scenarios)./run_all --quick→ all tests PASSEDpre-commit(ruff, black, cspell, etc.) → PASSEDAll FIT payment functionality — generation tariff, deemed export, clipping-aware income, and the
fit_income/fit_income_best/fit_income_yesterdaysensors — is preserved.🤖 Generated with Claude Code
Generated by Claude Code