Exclude high-churn energy sensor attrs from recorder (#197)#202
Merged
cayossarian merged 2 commits intomainfrom Mar 23, 2026
Merged
Exclude high-churn energy sensor attrs from recorder (#197)#202cayossarian merged 2 commits intomainfrom
cayossarian merged 2 commits intomainfrom
Conversation
Set SpanEnergySensorBase._unrecorded_attributes for grace-period and dip diagnostics plus circuit tabs and nominal voltage. Live entity attributes unchanged; RestoreSensor storage unchanged. Add test and 2.0.4 changelog. Made-with: Cursor
There was a problem hiding this comment.
Pull request overview
This PR reduces Home Assistant recorder database churn for Span energy sensors by marking several high-frequency (and some redundant) extra_state_attributes as unrecorded, while keeping live entity attributes and RestoreSensor storage behavior unchanged.
Changes:
- Add
_unrecorded_attributestoSpanEnergySensorBaseto exclude grace-period/dip diagnostics plustabsandvoltagefrom recorder history. - Add a unit test asserting the entity’s combined unrecorded-attribute set includes these keys.
- Document the change in the 2.0.4 changelog entry.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
custom_components/span_panel/sensor_base.py |
Defines the new unrecorded-attributes set and applies it to SpanEnergySensorBase to reduce recorder churn. |
tests/test_energy_sensor_recorder.py |
Adds coverage to ensure the relevant attributes are excluded from recorder persistence. |
CHANGELOG.md |
Notes the recorder churn reduction in the 2.0.4 release notes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Copilot PR #202: comment wrongly implied circuit-only; SpanEnergySensorBase covers panel and circuit energy entities. Made-with: Cursor
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.
Set SpanEnergySensorBase._unrecorded_attributes for grace-period and dip diagnostics plus circuit tabs and nominal voltage. Live entity attributes unchanged; RestoreSensor storage unchanged. Add test and 2.0.4 changelog.