Implement quirks v2 unique_id_suffix#362
Conversation
| if entity_metadata.unique_id_suffix: | ||
| self._unique_id_suffix = ( | ||
| f"{self._unique_id_suffix}-{entity_metadata.unique_id_suffix}" | ||
| ) |
There was a problem hiding this comment.
You mean that instead of appending the quirks v2 provided unique_id_suffix to the existing unique_id_suffix (created in the lines above), that we just replace it?
I guess that could work. The "attribute_name + extra suffix" is likely a bit unnecessary.
It would still be a suffix (to the original UID of IEEE +endpoint+cluster), so I'd keep the name the same probably and just change the implementation here. I don't think we should or even need to allow changing the whole UID (or the first part).
Changing just this suffix part to not append to the attr name should allow quirks v2 to take over ZHA/"v1" entities.
df4c30f to
a1489ea
Compare
|
Changed the implementation to override the default attribute name (Tests will fail until zigpy PR is merged + bump) |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #362 +/- ##
=======================================
Coverage 96.58% 96.58%
=======================================
Files 61 61
Lines 9512 9514 +2
=======================================
+ Hits 9187 9189 +2
Misses 325 325 ☔ View full report in Codecov by Sentry. |
DRAFT until zigpy bump is made and merged
Proposed change
This implements the quirks v2
unique_id_suffixthat's appended to the existingunique_idof IEEE+endpoint+cluster (or something like that). So, it just replaces the default ZHAunique_id_suffix(which is the attribute name for v2 quirk entities by default)This is needed when there are multiple quirks v2 entities for a specific attribute.
A test is also added that checks this for "write attr buttons" (writing the same attribute with different values).
Additional information
Corresponding zigpy PR:
unique_id_suffixto quirks v2 zigpy#1541Closes: