Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

fix unhandled exception on scan timeout #5

Merged
merged 1 commit into from
Jan 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions custom_components/zha_map/neighbour.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,17 @@ async def scan(self):
"""Scan for neighbours."""
idx = 0
while True:
status, val = await self.device.zdo.request(
zdo_t.ZDOCmd.Mgmt_Lqi_req, idx, tries=3, delay=1
)
self.debug("neighbor request Status: %s. Response: %r", status, val)
if zdo_t.Status.SUCCESS != status:
self.supported = False
self.debug("device does not support 'Mgmt_Lqi_req'")
try:
status, val = await self.device.zdo.request(
zdo_t.ZDOCmd.Mgmt_Lqi_req, idx, tries=3, delay=1
)
self.debug("neighbor request Status: %s. Response: %r", status, val)
if zdo_t.Status.SUCCESS != status:
self.supported = False
self.debug("device does not support 'Mgmt_Lqi_req'")
return
except asyncio.TimeoutError:
self.debug("'Mgmt_Lqi_req' timedout")
Adminiuga marked this conversation as resolved.
Show resolved Hide resolved
return

neighbors = val.NeighborTableList
Expand Down