Skip to content

[ZHA] Quirks v2 attributes not initialized for unclaimed cluster handlers #52

@TheJulianJES

Description

@TheJulianJES

Reference: https://github.com/zigpy/zha/blob/b17254948690f740a2b795d28dfad5304ad98291/zha/application/discovery.py#L255-L285
While the discovery logic was nicely cleaned up at some point, it didn't fix an issue that already existed before:

By default, cluster handlers are unclaimed. This is an issue because ZHA will only initialize attributes and bind the clusters if they are claimed.
The cluster handlers can be claimed by adding the cluster IDs to the relevant ZHA cluster registries. This has been done for a lot of manufacturer cluster IDs already. Since they're often reused between manufacturers, this is rarely an issue.

But they can also be claimed by providing the report_config kwarg to a quirks v2 entity. This will cause the discovery logic linked above to claim the cluster handler, so the cluster is bound, which is required for attribute reporting (for most devices).
But, we currently don't claim the cluster if only attributes need to be read. Since they're not claimed, ZHA never starts the cluster handler configuration, thus never reading attributes, causing quirks v2 to be "unknown" (if they're on an unclaimed (manufacturer) cluster).

Tasks:

  • fix the logic to claim cluster handlers for initializing (quirks v2) attributes
    • since BIND = True by default, set to False if REPORT_CONFIG empty for cluster handler, to avoid unnecessarily binding clusters
    • make sure to we don't mess up anything by overriding BIND unexpectedly
  • add quirks v2 methods to:
    • claim cluster handler, no binding (-> verify if we ever need this)
    • tell ZHA to bind the cluster, implying claiming (-> we definitely need this)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions