Skip to content

Remove non-ZCL siren select entities for basic sirens#666

Merged
TheJulianJES merged 4 commits intozigpy:devfrom
TheJulianJES:tjj/siren_select_feature
Mar 25, 2026
Merged

Remove non-ZCL siren select entities for basic sirens#666
TheJulianJES merged 4 commits intozigpy:devfrom
TheJulianJES:tjj/siren_select_feature

Conversation

@TheJulianJES
Copy link
Copy Markdown
Contributor

@TheJulianJES TheJulianJES commented Feb 21, 2026

Proposed change

This removes the non-ZCL select entities created for sirens IF they hint "siren_basic" as an "exposed feature" from quirks.

This is done by adding not_exposed_features to discovery. This might also come in handy for future entities. This was one of the suggested options to achieve this from the PR linked below.

Other options would have included overriding is_supported in all three classes to ignore based on the exposed features OR creating three more classes and making use of feature_priority to always return False for is_supported in the basic siren ZCL select entities. IMO, the not_exposed_features is cleaner and "fine".

Additional information

Related (and see for more description):

@TheJulianJES TheJulianJES mentioned this pull request Feb 21, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.62%. Comparing base (4261e97) to head (42b5a35).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #666   +/-   ##
=======================================
  Coverage   97.62%   97.62%           
=======================================
  Files          62       62           
  Lines       10761    10764    +3     
=======================================
+ Hits        10505    10508    +3     
  Misses        256      256           

☔ 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 TheJulianJES force-pushed the tjj/siren_select_feature branch from 9e4f067 to 42b5a35 Compare March 25, 2026 03:25
@TheJulianJES TheJulianJES marked this pull request as ready for review March 25, 2026 03:26
Copilot AI review requested due to automatic review settings March 25, 2026 03:26
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 updates ZHA’s registry-based entity discovery to support excluding entities based on quirk “exposed features”, and uses that to prevent creating the non-ZCL siren-related select entities for devices marked as siren_basic.

Changes:

  • Add not_exposed_features to ClusterHandlerMatch as a negative filter for entity discovery.
  • Update discovery to skip entity classes when a device exposes any excluded features.
  • Mark the non-ZCL IAS WD select entities as excluded for SIREN_BASIC devices and update device snapshot JSONs accordingly.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
zha/application/platforms/select.py Excludes non-ZCL IAS WD select entities when SIREN_BASIC is exposed.
zha/application/platforms/__init__.py Extends ClusterHandlerMatch with not_exposed_features.
zha/application/discovery.py Applies the new negative exposed-feature filter during endpoint entity discovery.
tests/data/devices/frient-a-s-smszb-120.json Updates expected discovered entities by removing select entities for basic siren device.
tests/data/devices/frient-a-s-scazb-141.json Same as above for another basic siren device snapshot.
tests/data/devices/frient-a-s-flszb-110.json Same as above for another basic siren device snapshot.

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

Comment on lines 88 to 92
manufacturers: frozenset[str] | None = None
models: frozenset[str] | None = None
exposed_features: frozenset[str] | None = None
not_exposed_features: frozenset[str] | None = None

Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

ClusterHandlerMatch is not kw_only, so adding not_exposed_features in the middle of the dataclass field list is a backwards-incompatible change for any positional instantiations (they’d start binding later positional args to the new field). To minimize API breakage risk, either append not_exposed_features to the end of the dataclass fields (after feature_priority) or make the dataclass kw_only=True so only keyword construction is allowed.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We should likely just make this kw_only. We're already using it as such, so this isn't breaking anything.

@TheJulianJES
Copy link
Copy Markdown
Contributor Author

In the future, we likely want these non-ZCL entities to be bound to the presence of the AdvancedSiren entity.
However, I'm not rewriting discovery at 4am, so this will be good enough for now. That does mean we're adding not_exposed_features temporarily, but it's a minor change we can revert when the other discovery stuff is rewritten.

@TheJulianJES TheJulianJES merged commit 5a353cf into zigpy:dev Mar 25, 2026
13 checks passed
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