Skip to content

fix(output): show a car icon and "Hold for car" reason when discharge is held for a charging car - #5147

Open
chalfontchubby wants to merge 1 commit into
mainfrom
fix/plan-hold-for-car
Open

chalfontchubby wants to merge 1 commit into
mainfrom
fix/plan-hold-for-car

Conversation

@chalfontchubby

Copy link
Copy Markdown
Collaborator

Written by Claude, on behalf of @chalfontchubby.

Summary

  • execute.py already labels the live status "Hold for car" when car_charging_from_battery is off and a car charging slot blocks battery discharge outside a charge window (execute.py:594-629). The plan table had no equivalent - the same held SoC rendered as a plain trend arrow with no indication of why.
  • Adds a hold_for_car reason code to the plan JSON, gated on the same condition execute.py/prediction.py:865 already use (set_charge_window on, car_charging_from_battery off, a car charging slot overlapping the row), so the plan's hover/tap explanation is consistent with the live status text.
  • Swaps the state cell's arrow for a car icon (🚗) in that case, the same way the existing sun glyph signals a PV-driven rise - so the hold is visible at a glance, not just on hover.
  • Display only. The underlying hold behaviour (battery not discharging while the car charges) was already correct; nothing about prediction or execution changes.

Fixes #5146, found while investigating #5122.

Test plan

  • New test cases in test_plan_why_reason.py: a car-held Demand slot reads as hold_for_car and shows the car icon; the same slot with car_charging_from_battery on stays plain demand_steady (negative case)
  • ./run_all --test plan_why_reason passes
  • ./run_all --quick passes (all tests, 4 slow skipped)
  • Manually replayed the reporter's own attached debug.yaml (predbat_debug_20260917-210000.yaml) - all four slots matching his car charging schedule now show the icon; plan SoC/cost numbers unchanged

… is held for a charging car

execute.py already labels the live status "Hold for car" when car_charging_from_battery
is off and a car charging slot blocks battery discharge outside a charge window, but the
plan table had no equivalent - the same held SoC rendered as a plain arrow with no
indication of why. Adds a hold_for_car reason code (gated on the same condition) and swaps
the state cell's arrow for a car icon in that case, so the plan explains itself at a glance
and on hover/tap, the same way the existing sun glyph signals a PV-driven rise.

Display only - the underlying hold behaviour was already correct.

Fixes #5146

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

Plan table doesn't show 'Hold for car' when battery discharge is held for a charging car

1 participant