-
Notifications
You must be signed in to change notification settings - Fork 53
Description
Issue
We do not seem to keep the original_signature
in diagnostics for v2 quirks.
We have this logic: zha/zigbee/device.py#L1401-L1404
, where we use replacement
for v2 quirks, but that'll always be empty from what I can see, due to this: zigpy/quirks/v2/__init__.py#L80-L83
. It also doesn't seem to make sense that we'd wanna use the (generated) replacement
anyway. Both sections seem improvable in general.
Why this is bad
It's important to always include the original signature in diagnostics as well, as quirk changes will persist through regenerated diagnostics otherwise. See the following example:
So, when changing or developing new quirks, it looks they'll always be added on top of the modified data from last time when regenerating diagnostics. Let's say we generate diagnostics from a device with a v2 quirk that adds endpoint 10
with the LevelControl
cluster.
If we later update the v2 quirk to not touch endpoint 10 (and clusters on that ep) at all, then regenerate diagnostics, we'll still have ep 10 with LevelControl
present from what I can see.
On a real setup, this likely won't happen, as the original ep/cluster information is saved in the zigpy DB and not touched*.
*: Unfortunately, there were also some zigpy versions that committed quirked clusters/signatures in the DB, so we'll have to keep that in mind if we get diagnostics from devices added over the last years.
Due to how zigpy currently applies quirks (i.e. adding endpoints and clusters), it might be hard to get the original signature for device using v2 quirks, without changing zigpy or directly accessing the zigpy database.
Additional
(Original message posted on Discord: https://discord.com/channels/330944238910963714/1346942546714296351/1392692772691120158)