Skip to content

Add more sensor entity metadata fields to change_entity_metadata#1721

Open
puddly wants to merge 2 commits intozigpy:devfrom
puddly:puddly/sensor-metadata-changing
Open

Add more sensor entity metadata fields to change_entity_metadata#1721
puddly wants to merge 2 commits intozigpy:devfrom
puddly:puddly/sensor-metadata-changing

Conversation

@puddly
Copy link
Copy Markdown
Collaborator

@puddly puddly commented Dec 11, 2025

suggested_display_precision is really the only one I'm interested in using but I've added the rest as well.

Copilot AI review requested due to automatic review settings December 11, 2025 17:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the change_entity_metadata function to support additional sensor entity metadata fields. While the PR author's primary interest is suggested_display_precision, the implementation comprehensively adds all relevant fields including new_unit, new_divisor, new_multiplier, new_min, new_max, new_step, and new_mode.

Key Changes:

  • Added 8 new metadata fields to the ChangedEntityMetadata class and change_entity_metadata method
  • Enhanced test coverage to validate the new fields
  • Cleaned up test assertions by removing explicit None values for better readability

Reviewed changes

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

File Description
zigpy/quirks/v2/init.py Added 8 new metadata fields (new_suggested_display_precision, new_unit, new_divisor, new_multiplier, new_min, new_max, new_step, new_mode) to both the ChangedEntityMetadata class and the change_entity_metadata method, properly threading them through the implementation
tests/test_quirks_v2.py Added comprehensive test case for the new fields and improved test assertion readability by removing unnecessary explicit None value specifications

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.29%. Comparing base (7c805e0) to head (f3f6aee).
⚠️ Report is 6 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1721   +/-   ##
=======================================
  Coverage   99.29%   99.29%           
=======================================
  Files          63       63           
  Lines       12263    12271    +8     
=======================================
+ Hits        12177    12185    +8     
  Misses         86       86           

☔ View full report in Codecov by Sentry.
📢 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.

@TheJulianJES
Copy link
Copy Markdown
Contributor

I do kind of wish we'd require specifying the platform for change_entity_metadata. That would make it much easier to generate translation keys for new ones specified in change_entity_metadata, without the need of discovering all entities.
It should also be clearer in quirks to quickly see what kind of entity/platform is affected.
And lastly, it might also help avoid some accidental matching of multiple similar entities that are different per platform.

@TheJulianJES TheJulianJES added the smash This PR is close to be merged soon label Dec 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

smash This PR is close to be merged soon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants