Skip to content

Remove the primary_weight pass-through property - #876

Draft
TheJulianJES wants to merge 1 commit into
zigpy:devfrom
TheJulianJES:tjj/remove-primary-weight-property
Draft

Remove the primary_weight pass-through property#876
TheJulianJES wants to merge 1 commit into
zigpy:devfrom
TheJulianJES:tjj/remove-primary-weight-property

Conversation

@TheJulianJES

Copy link
Copy Markdown
Contributor

Follow-up to a TODO in #861.

Removes the primary_weight pass-through property. Its only caller is the primary entity election, which already reads the raw _attr_primary hint directly — the election now uniformly consumes the _attr_* inputs.

No subclass overrides the property (all set the _attr_primary_weight class attribute), and no other consumer exists in ZHA, HA Core, or zha-quirks. Note that this is technically a public-API removal (the property shipped since 0.0.51), but the library's real consumers never used it.

Its only caller is the primary entity election, which already reads the
raw `_attr_primary` hint directly — the election now uniformly consumes
the `_attr_*` inputs.
@TheJulianJES
TheJulianJES requested a balanced review from Copilot August 26, 2026 02:43
@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.19%. Comparing base (f6273ae) to head (eb718d6).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #876      +/-   ##
==========================================
- Coverage   97.19%   97.19%   -0.01%     
==========================================
  Files          57       57              
  Lines       10543    10540       -3     
==========================================
- Hits        10247    10244       -3     
  Misses        296      296              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the unused primary_weight pass-through property and makes primary-entity election consume _attr_primary_weight directly.

Changes:

  • Removed BaseEntity.primary_weight.
  • Updated all election weight reads to use _attr_primary_weight.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
zha/zigbee/device.py Reads raw primary-weight attributes during election.
zha/application/platforms/__init__.py Removes the unused public property.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

2 participants