Improve discovery error output (#134)

This commit is contained in:
Pierre Ståhl
2020-11-17 12:26:18 +01:00
committed by GitHub
parent 3e52811aac
commit c8a44019fa
4 changed files with 34 additions and 24 deletions

View File

@@ -55,7 +55,7 @@ class TuyaDiscovery(asyncio.DatagramProtocol):
def close(self):
"""Stop discovery."""
self.callback = None
for transport, _ in self.listeners:
for transport, _ in self._listeners:
transport.close()
def datagram_received(self, data, addr):
@@ -85,8 +85,6 @@ async def discover():
try:
await discover.start()
await asyncio.sleep(DEFAULT_TIMEOUT)
except Exception:
_LOGGER.exception("failed to discover devices")
finally:
discover.close()
return discover.devices