Let Hue sensor cluster inherit from OccupancySensing#4793
Let Hue sensor cluster inherit from OccupancySensing#4793TheJulianJES merged 2 commits intozigpy:devfrom
OccupancySensing#4793Conversation
OccupancySensing and remove `ep…OccupancySensing
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #4793 +/- ##
=======================================
Coverage 92.65% 92.66%
=======================================
Files 379 380 +1
Lines 12745 12766 +21
=======================================
+ Hits 11809 11829 +20
- Misses 936 937 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR updates the Philips Hue occupancy cluster implementation to use the standard OccupancySensing inheritance and endpoint attribute name, enabling ZHA to create the new occupancy delay number entities (e.g., pir_o_to_u_delay) introduced upstream.
Changes:
- Make
PhilipsOccupancySensinginherit fromOccupancySensingand remove the customep_attributeoverride. - Switch Philips occupancy manufacturer attributes to use explicit
manufacturer_code=0x100B. - Adjust
test_attributes_updated_not_replacedto accommodate the Philips occupancy cluster’s attribute definition behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
zhaquirks/philips/__init__.py |
Updates the Philips occupancy cluster to inherit OccupancySensing and use explicit manufacturer codes for vendor attributes. |
tests/test_quirks.py |
Updates attribute-extension tests to avoid failing on the Philips occupancy cluster’s overlapping manufacturer/ZCL attribute IDs. |
|
Tested and working with this ZHA PR: It's a small-ish change and confirmed working. I'll go ahead with this, so users can finally get the timeout entities on Hue sensors. |
Proposed change
This removes the
ep_attributeoverride for the Hue sensor occupancy cluster. The cluster now also inherits fromOccupancySensing.Additional information
Recently, ZHA introduced support for the
pir_o_to_u_delayattribute/entity with zigpy/zha#669. This should be supported by the Hue sensors as well. However, the number entities aren't created as they require theoccupancyep_attribute(cluster handler name), yet the Hue sensors usephilips_occupancy: zha/application/platforms/binary_sensor/init.py#L199-L209.This was done as the custom Hue attributes conflicted with the ZCL attribute IDs for
physical_contact_u_to_o_delay+physical_contact_o_to_u_delayattributes. As zigpy now properly supports ZCL attributes and manufacturer-specific ones using the same attribute ID, we no longer need this workaround.Device diagnostics
Should be in ZHA.
Checklist
pre-commitchecks pass / the code has been formatted using Black