refactor: _safe_fetch helper + price-sensor MRO cleanup - #12
Merged
Conversation
- Extract `_safe_fetch(label, fn)` in __init__.py: fold the three copies of `try SDK call; except: warn+None` into one helper. Applied to the system-details, subscriptions, and impact-overview fetches. - Add `_DescriptionValueSensor` to `OneKomma5PriceSensor` MRO and drop the byte-equivalent `native_value` override; the custom `extra_state_attributes` (only fires for current-price) stays as-is. Both changes preserve behaviour — full suite green, live-verified on homie (daily_savings co2_saved_kg, aktueller_strompreis forecast + attributes, DP price-guarantee sensor). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This was referenced Aug 12, 2026
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
Two-candidate refactor sweep from the post-0.1.53 audit — both preserve behaviour, both fully covered by the existing tests.
Test plan
Rejected from the same audit (memory in `~/.claude/projects/-Users-markus-Sources-1komma5-ha/`): base-coordinator `_on_data` hook (bigger blast radius, better as its own PR); EV entity ctor consolidation (blast across 5 modules, defer).