From 23b0cfde6dc54414389964a46690ecca030da13a Mon Sep 17 00:00:00 2001 From: Luke Bonaccorsi Date: Tue, 12 Sep 2023 16:10:28 +0100 Subject: [PATCH] Allow port reuse so that other integrations can read the same port (#1481) Co-authored-by: rospogrigio <49229287+rospogrigio@users.noreply.github.com> --- custom_components/localtuya/discovery.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/localtuya/discovery.py b/custom_components/localtuya/discovery.py index d18e376..0c93ab7 100644 --- a/custom_components/localtuya/discovery.py +++ b/custom_components/localtuya/discovery.py @@ -43,10 +43,10 @@ class TuyaDiscovery(asyncio.DatagramProtocol): """Start discovery by listening to broadcasts.""" loop = asyncio.get_running_loop() listener = loop.create_datagram_endpoint( - lambda: self, local_addr=("0.0.0.0", 6666) + lambda: self, local_addr=("0.0.0.0", 6666), reuse_port=True ) encrypted_listener = loop.create_datagram_endpoint( - lambda: self, local_addr=("0.0.0.0", 6667) + lambda: self, local_addr=("0.0.0.0", 6667), reuse_port=True ) self._listeners = await asyncio.gather(listener, encrypted_listener)