Add discovery port 20004 (#1595)
Some checks failed
CI / Perform linting checks (3.13) (push) Has been cancelled
CodeQL checks / Analyze (python) (push) Has been cancelled
CI / Python 3.11 on macos-latest (push) Has been cancelled
CI / Python 3.12 on macos-latest (push) Has been cancelled
CI / Python 3.13 on macos-latest (push) Has been cancelled
CI / Python 3.11 on ubuntu-latest (push) Has been cancelled
CI / Python 3.12 on ubuntu-latest (push) Has been cancelled
CI / Python 3.13 on ubuntu-latest (push) Has been cancelled
CI / Python 3.11 on windows-latest (push) Has been cancelled
CI / Python 3.12 on windows-latest (push) Has been cancelled
CI / Python 3.13 on windows-latest (push) Has been cancelled
Stale / stale (push) Has been cancelled

Adds additional discovery port for Tapo Doorbells (D210 and D225)

---------

Co-authored-by: Sameer Alam <alams154@users.noreply.github.com>
This commit is contained in:
Sameer Alam
2025-10-27 15:55:34 -05:00
committed by GitHub
parent 358454e516
commit f30f38b887
2 changed files with 6 additions and 2 deletions

View File

@@ -264,6 +264,7 @@ class _DiscoverProtocol(asyncio.DatagramProtocol):
self.target = target
self.target_1 = (target, self.discovery_port)
self.target_2 = (target, Discover.DISCOVERY_PORT_2)
self.target_3 = (target, Discover.DISCOVERY_PORT_3)
self.discovered_devices = {}
self.unsupported_device_exceptions: dict = {}
@@ -333,6 +334,7 @@ class _DiscoverProtocol(asyncio.DatagramProtocol):
break
self.transport.sendto(encrypted_req[4:], self.target_1) # type: ignore
self.transport.sendto(aes_discovery_query, self.target_2) # type: ignore
self.transport.sendto(aes_discovery_query, self.target_3) # type: ignore
await asyncio.sleep(sleep_between_packets)
def datagram_received(
@@ -361,7 +363,7 @@ class _DiscoverProtocol(asyncio.DatagramProtocol):
if port == self.discovery_port:
json_func = Discover._get_discovery_json_legacy
device_func = Discover._get_device_instance_legacy
elif port == Discover.DISCOVERY_PORT_2:
elif port in (Discover.DISCOVERY_PORT_2, Discover.DISCOVERY_PORT_3):
json_func = Discover._get_discovery_json
device_func = Discover._get_device_instance
else:
@@ -422,6 +424,7 @@ class Discover:
}
DISCOVERY_PORT_2 = 20002
DISCOVERY_PORT_3 = 20004
DISCOVERY_QUERY_2 = binascii.unhexlify("020000010000000000000000463cb5d3")
_redact_data = True