Skip to content

feat(car): one charging decision, resting in solar rather than off - #4

Merged
mbuhansen merged 1 commit into
mainfrom
fix/car-plugged-state
Aug 19, 2026
Merged

mbuhansen merged 1 commit into
mainfrom
fix/car-plugged-state

Conversation

@mbuhansen

Copy link
Copy Markdown
Owner

The choice between charging now, following the sun and not charging lived inside the evcc component, derived from two binary sensors. It is now Predbat's own decision, published per car as sensor.predbat_car_charging_mode with a reason attribute; the evcc component maps those three states onto evcc's modes and decides nothing itself, so evcc and a plain Home Assistant automation driving any other charger behave identically.

Solar is now the resting state rather than off. off means "do not charge from the surplus", and for a charger holding its own departure plan - evcc included - off takes that plan down with it, which is the plan the component exists to read. off is published only when it is a decision: the export pays better, or the car does no solar charging at all.

Mode reason evcc
now grid_slot now
solar solar / idle pv (or minpv)
off export_better / solar_disabled off

New car_charging_mode test covering all six cases without evcc, plus the reworked evcc mapping tests. Docs updated in car-charging.md, components.md and customisation.md.

🤖 Generated with Claude Code

…an off

The choice between charging now, following the sun and not charging lived inside the evcc
component, derived from two binary sensors. Anyone driving another charger from Home Assistant had
to re-derive it, and could combine the sensors into states Predbat never meant.

It is now Predbat's own decision, published per car as sensor.<prefix>_car_charging_mode with a
reason attribute. The evcc component maps those three states onto evcc's modes and decides nothing
itself, so evcc and a plain automation behave identically.

Solar is now the resting state rather than off. Off means "do not charge from the surplus", and for
a charger holding its own departure plan - evcc included - off takes that plan down with it, which
is the plan the component exists to read. Off is therefore published only when it is a decision:
the export pays better, or this car does no solar charging. Not being plugged in is an absence, not
a decision, and leaves the charger following the sun.

The solar slot sensor now also carries why it is off, which is what separates those cases.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mbuhansen
mbuhansen force-pushed the fix/car-plugged-state branch from 02cd6e9 to a6053c8 Compare August 19, 2026 16:10
@mbuhansen
mbuhansen merged commit 04a1448 into main Aug 19, 2026
1 of 2 checks passed
@mbuhansen
mbuhansen deleted the fix/car-plugged-state branch August 19, 2026 16:10
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