refactor(ev): pass ev object directly to EV entity ctors - #14
Merged
Conversation
Every EV setup site unpacked ev.id(), ev.manufacturer(), ev.model()
into three positional args, then passed them to the constructor which
reassembled them into a DeviceInfo. Two subclasses (Select / Time)
additionally accepted the whole ev_charger and stored it on
self._ev_charger — a field that was never read (all reads route
through the parent's _get_ev()).
OneKomma5EVEntity now takes the ev object directly and reads
.id() / .manufacturer() / .model() internally. The four subclasses
(Sensor / Number / Select / Time) drop three positional args each,
and the two dead self._ev_charger fields are gone.
Unique-id and stable_object_id formulas are unchanged
(f"{system_id}_{ev.id()}_{suffix}") — statistics, automations, and
existing entity_ids all survive.
Suite green (226); live-verified on homie — all four EV entity
platforms (select.<>_lademodus, time.<>_abfahrtzeit,
number.<>_ziel_akkustand, sensor.<>_ziel_akkustand + friends) still
register with correct state.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
mrebbert
pushed a commit
that referenced
this pull request
Aug 12, 2026
Three PRs (#12/#13/#14) landed post-#11 with no user-visible change — document them under `[Unreleased] > Changed` so the eventual release captures them alongside the co2_saved_kg addition. Per feedback-release-notes-scope memory: refactor mentions stay in CHANGELOG only; release-notes/v0.1.53.md (when created at release time) stays user-facing. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fourth (and last) candidate from the post-0.1.53 refactor audit.
Every EV setup site unpacked `ev.id()`, `ev.manufacturer()`, `ev.model()` into three positional args, then passed them to the constructor which reassembled them into a `DeviceInfo`. Two subclasses (`Select` / `Time`) additionally accepted the whole `ev_charger` and stored it on `self._ev_charger` — a field that was never read (all reads route through the parent's `_get_ev()`).
Net −86 lines across 6 files (mostly disappearing setup boilerplate).
Stability contract
Unique-id and `stable_object_id` formulas are unchanged (`f"{system_id}{ev.id()}{suffix}"`) — statistics, automations, and existing `entity_id`s all survive.
Test plan
Independence
Touches EV entity plumbing only. No overlap with #12 (`init.py` + price-sensor MRO) or #13 (`coordinator.py`).