Skip to content

fix(compare) compare tariffs using stale iBoost plan from live tariff - #4661

Open
chickenonaraft88 wants to merge 1 commit into
springfall2008:mainfrom
chickenonaraft88:worktree-fix-iboost-compare-recompute
Open

fix(compare) compare tariffs using stale iBoost plan from live tariff#4661
chickenonaraft88 wants to merge 1 commit into
springfall2008:mainfrom
chickenonaraft88:worktree-fix-iboost-compare-recompute

Conversation

@chickenonaraft88

@chickenonaraft88 chickenonaraft88 commented Aug 22, 2026

Copy link
Copy Markdown

Summary

compare.py's run_single() swaps in each compared tariff's own import/export rates, but iboost_plan (the low-rate slots iBoost is allowed to run in) was only ever computed once, at startup, against the live tariff's rates. Every tariff comparison reused that same stale plan, so a compare-plan's iBoost timing reflected your current live tariff instead of the tariff actually being compared — it would show iBoost running at your live tariff's cheap period even on a tariff with a completely different rate structure.

Fix

  • Added recompute_iboost() to Compare, mirroring the existing recompute_car_charging() pattern, and call it per tariff in run_single() right before the car charging recompute.
  • The guard condition matches fetch.py's existing logic for when the live plan builds iboost_plan, so Compare now decides whether/how to plan iBoost exactly the same way the real plan does.
  • Save/restore iboost_plan in run_all() alongside iboost_today, so the live plan's iBoost schedule isn't left clobbered by whichever tariff ran last.

Before / after

Before the fix — iBoost only ran on the current tariff's cheap slot, and on "EDF Go Electric" it ran during the expensive daytime rate instead of that tariff's own cheap overnight period:

Current tariff
agilecompareiboost

Other tariff
edfcompareiboost

After the fix — each tariff's compare-plan now schedules iBoost against its own rates, running during EDF Go Electric's cheap overnight window while the battery charges:

Current tariff
image

Other tariff
image

Test plan

  • Added test_compare.py T13/T14 covering run_single() recomputing iboost_plan per tariff, and clearing it when smart-rate planning doesn't apply
  • ./run_all --test compare --test iboost_smart passes
  • ./run_all --quick passes (one pre-existing unrelated flaky failure in fox_api's test_run_midnight_reset, confirmed present without this change too)
  • Verified against real EDF Go Electric compare data in Home Assistant — iBoost now runs during the tariff's own 6.99p overnight window while charging, instead of the live tariff's expensive daytime slot

@chickenonaraft88
chickenonaraft88 marked this pull request as draft August 22, 2026 21:57
@chickenonaraft88
chickenonaraft88 marked this pull request as ready for review August 22, 2026 21:58
@chickenonaraft88 chickenonaraft88 changed the title Fix compare tariffs using stale iBoost plan from live tariff fix(compare) compare tariffs using stale iBoost plan from live tariff Aug 22, 2026
…ariff

iboost_plan (the low-rate slots iBoost may run in) was only ever
computed once against the live tariff's rates. Compare scenarios
swapped in each tariff's own rates but reused that stale plan, so
iBoost timing in a compare-plan reflected the current live tariff
instead of the one being compared.

Add recompute_iboost(), matching the existing recompute_car_charging
pattern, and call it per tariff in run_single(). Save/restore
iboost_plan in run_all() alongside iboost_today.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@chickenonaraft88
chickenonaraft88 force-pushed the worktree-fix-iboost-compare-recompute branch from 8569d33 to 6665ac1 Compare August 22, 2026 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant