mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
zha: Fix cluster class check in single-cluster device type (#14303)
zigpy now allows custom devices, which might mean that devices have cluster objects which are not instances of the default, but may be instances of sub-classes of the default. This fixes the check for finding single-cluster device entities to handle sub-classes properly.
This commit is contained in:
parent
954e4796b8
commit
2f74ffcf81
@ -256,11 +256,16 @@ class ApplicationListener:
|
|||||||
"""Try to set up an entity from a "bare" cluster."""
|
"""Try to set up an entity from a "bare" cluster."""
|
||||||
if cluster.cluster_id in profile_clusters:
|
if cluster.cluster_id in profile_clusters:
|
||||||
return
|
return
|
||||||
# pylint: disable=unidiomatic-typecheck
|
|
||||||
if type(cluster) not in device_classes:
|
component = None
|
||||||
|
for cluster_type, candidate_component in device_classes.items():
|
||||||
|
if isinstance(cluster, cluster_type):
|
||||||
|
component = candidate_component
|
||||||
|
break
|
||||||
|
|
||||||
|
if component is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
component = device_classes[type(cluster)]
|
|
||||||
cluster_key = "{}-{}".format(device_key, cluster.cluster_id)
|
cluster_key = "{}-{}".format(device_key, cluster.cluster_id)
|
||||||
discovery_info = {
|
discovery_info = {
|
||||||
'application_listener': self,
|
'application_listener': self,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user