Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
CALIBRATION_NO_SOC_SOURCE,
CALIBRATION_NOT_DISPATCHED,
CALIBRATION_PLAN_NOT_EXECUTED,
CALIBRATION_SAMPLED,
CALIBRATION_STEP_INCOMPLETE,
CHARGE_CALIBRATION,
DISCHARGE_CALIBRATION,
Expand Down Expand Up @@ -2218,7 +2219,12 @@ def _update_battery_eff_calibration(
)
actual_delta = max(0.0, measured)

if calibration.record(planned_delta, actual_delta, "SoC delta"):
moved = calibration.record(planned_delta, actual_delta, "SoC delta")
# Always persist after a sample, not only when the correction moves.
# When the correction is at the cap (1.05) every new sample is added to
# the rolling window but never triggers a save, so the file on disk stays
# in the old raw_ratio format and is re-migrated on every restart.
if moved or calibration.last_result == CALIBRATION_SAMPLED:
self.hass.async_create_task(calibration.async_save())

def _update_charge_eff_calibration(
Expand Down
Loading