Allow direct binding via ZHA for the ZLL profile (#23536)

* allow binding for zll profile
* update check - review comment
This commit is contained in:
David F. Mulcahey 2019-04-29 11:35:19 -04:00 committed by Alexei Chetroi
parent e08f2ad18d
commit 75f53b2799
2 changed files with 11 additions and 8 deletions

View File

@ -321,15 +321,18 @@ class ZHADevice:
}
@callback
def async_get_zha_clusters(self):
"""Get zigbee home automation clusters for this device."""
from zigpy.profiles.zha import PROFILE_ID
def async_get_std_clusters(self):
"""Get ZHA and ZLL clusters for this device."""
from zigpy.profiles import zha, zll
return {
ep_id: {
IN: endpoint.in_clusters,
OUT: endpoint.out_clusters
} for (ep_id, endpoint) in self._zigpy_device.endpoints.items()
if ep_id != 0 and endpoint.profile_id == PROFILE_ID
if ep_id != 0 and endpoint.profile_id in (
zha.PROFILE_ID,
zll.PROFILE_ID
)
}
@callback

View File

@ -170,8 +170,8 @@ def get_attr_id_by_name(cluster, attr_name):
async def get_matched_clusters(source_zha_device, target_zha_device):
"""Get matched input/output cluster pairs for 2 devices."""
source_clusters = source_zha_device.async_get_zha_clusters()
target_clusters = target_zha_device.async_get_zha_clusters()
source_clusters = source_zha_device.async_get_std_clusters()
target_clusters = target_zha_device.async_get_std_clusters()
clusters_to_bind = []
for endpoint_id in source_clusters:
@ -193,8 +193,8 @@ async def get_matched_clusters(source_zha_device, target_zha_device):
@callback
def async_is_bindable_target(source_zha_device, target_zha_device):
"""Determine if target is bindable to source."""
source_clusters = source_zha_device.async_get_zha_clusters()
target_clusters = target_zha_device.async_get_zha_clusters()
source_clusters = source_zha_device.async_get_std_clusters()
target_clusters = target_zha_device.async_get_std_clusters()
bindables = set(BINDABLE_CLUSTERS)
for endpoint_id in source_clusters: