A momentary `unavailable` reading of a configured `soc_max` sensor caused
Predbat to fall back to the 8 kWh default and cache it, pinning the battery
size to 8 kWh for the rest of the day (until restart) even after the sensor
recovered. With the battery then appearing "full", grid charging was disabled.
Two fixes in Inverter.battery_size_tracking():
- Recompute soc_max from the recovered soc_max_nominal when the live read was
invalid, so the last known-good capacity takes effect instead of the fallback.
- Make the 8 kWh fallback non-sticky by no longer writing soc_max /
soc_max_nominal into base.args, so the next cycle re-reads the real source
(or restores the nominal) and recovers automatically.
Genuine first-run behaviour is preserved: with no config and no history the
fallback still applies 8 kWh per cycle and self-heals once a value is available.
Adds regression tests covering the transient-outage recovery and the
non-sticky fallback.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A momentary
unavailablereading of a configuredsoc_maxsensor caused Predbat to fall back to the 8 kWh default and cache it, pinning the battery size to 8 kWh for the rest of the day (until restart) even after the sensor recovered. With the battery then appearing "full", grid charging was disabled.Two fixes in Inverter.battery_size_tracking():
Genuine first-run behaviour is preserved: with no config and no history the fallback still applies 8 kWh per cycle and self-heals once a value is available.
Adds regression tests covering the transient-outage recovery and the non-sticky fallback.