Skip to content

Commit d32e245

Browse files
committed
Fix #272 Add missing check on user endpoint id
1 parent 3112960 commit d32e245

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

custom_components/zha_toolkit/binds.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -310,13 +310,15 @@ async def bind_ieee(
310310

311311
for src_ep in src_endpoints:
312312
LOGGER.debug(
313-
"0x%04x: binding %s/EP:%s, out-cluster 0x%04X to %s/EP:%s",
313+
"0x%04x: binding %s/EP:%s, out-cluster 0x%04X to %s/EP:%s"
314+
" (%r)",
314315
src_dev.nwk,
315316
str(src_dev.ieee),
316317
src_ep,
317318
src_out_cluster,
318319
str(dst_dev.ieee),
319320
dst_epid,
321+
dst_addr,
320322
)
321323
res = await u.retry_wrapper(
322324
zdo.request,
@@ -365,7 +367,11 @@ async def bind_ieee(
365367
for ep_id, ep in dst_dev.endpoints.items():
366368
if ep_id == 0:
367369
continue
368-
if isCoordinatorTarget or (src_in_cluster in ep.out_clusters):
370+
if (
371+
isCoordinatorTarget
372+
or (src_in_cluster in ep.out_clusters)
373+
and (u_dst_epid is None or u_dst_epid == ep_id)
374+
):
369375
dst_epid = ep_id
370376
break
371377
if not dst_epid:
@@ -374,13 +380,15 @@ async def bind_ieee(
374380

375381
for src_ep in src_endpoints:
376382
LOGGER.debug(
377-
"0x%04X: binding %s/EP:%s, in-cluster: 0x%04X to %s/EP:%s",
383+
"0x%04X: binding %s/EP:%s, in-cluster: 0x%04X to %s/EP:%s"
384+
" (%r)",
378385
src_dev.nwk,
379386
str(src_dev.ieee),
380387
src_ep,
381388
src_in_cluster,
382389
str(dst_dev.ieee),
383390
dst_epid,
391+
dst_addr,
384392
)
385393
if src_ep not in results:
386394
results[src_ep] = {}

0 commit comments

Comments
 (0)