Fix test_attributes_updated_not_replaced test#4794
Fix test_attributes_updated_not_replaced test#4794TheJulianJES wants to merge 5 commits intozigpy:devfrom
test_attributes_updated_not_replaced test#4794Conversation
…ecific colliding IDs
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #4794 +/- ##
=======================================
Coverage 92.65% 92.65%
=======================================
Files 379 379
Lines 12745 12745
=======================================
Hits 11809 11809
Misses 936 936 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| zhaquirks.sinope.switch.SinopeTechnologiesBasicCluster, | ||
| zhaquirks.sinope.switch.SinopeTechnologiesMeteringCluster, |
There was a problem hiding this comment.
The test didn't catch these before but they're really interesting:
Here, the default power_source attribute is overwritten (by name) with a manufacturer attribute and different attribute type:
zha-device-handlers/zhaquirks/sinope/switch.py
Lines 272 to 282 in becb068
And two ZCL attributes on the Metering cluster are overwritten here (by name as well) with a manufacturer attribute and different data type:
zha-device-handlers/zhaquirks/sinope/switch.py
Lines 294 to 302 in becb068
There's a bit more discussion on that here: #4042 (comment)
Ultimately, this should not be allowed, right? Should it be possible for a quirk just to change the data type, e.g. do this without manufacturer_code or is_manufacturer_specific? Also no, right?
I guess we can just rename the colliding Sinope attributes and we're good?
|
There is another case we should consider: zha-device-handlers/zhaquirks/bosch/rbsh_trv0_zb_eu.py Lines 156 to 162 in a37b631 Here, a ZCL attribute is overwritten with a manufacturer-specific one with the same name and a different data type, similar to the Sinope examples above, but the ID is also changed. For now, I'll try to see if I can add an exception for the Hue sensor in:
|
DRAFT. Testing.
Proposed change
test_attributes_updated_not_replacedto validate inherited attributes usingcluster._attributes_by_idinstead of flat.attributes, so valid manufacturer-specific definitions sharing a ZCL ID are handled correctly.OccupancySensing#4793manufacturer_code=Noneonly when the ID collides with a base ZCL attribute, while allowing non-colliding IDs.Additional information
Device diagnostics
None.
Checklist
pre-commitchecks pass / the code has been formatted using Black