From ae4137364ee4ceecc3257f726bf295829ce426f5 Mon Sep 17 00:00:00 2001 From: Martin <25747549+martgras@users.noreply.github.com> Date: Fri, 17 Sep 2021 19:22:20 +0200 Subject: [PATCH] fixes connection isssue#87 (#105) --- aioesphomeapi/host_resolver.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/aioesphomeapi/host_resolver.py b/aioesphomeapi/host_resolver.py index c05d851..c5201ca 100644 --- a/aioesphomeapi/host_resolver.py +++ b/aioesphomeapi/host_resolver.py @@ -187,8 +187,10 @@ async def _async_resolve_host_getaddrinfo( eventloop: asyncio.events.AbstractEventLoop, host: str, port: int ) -> List[AddrInfo]: try: - # Limit to TCP IP protocol - res = await eventloop.getaddrinfo(host, port, proto=socket.IPPROTO_TCP) + # Limit to TCP IP protocol and SOCK_STREAM + res = await eventloop.getaddrinfo( + host, port, type=socket.SOCK_STREAM, proto=socket.IPPROTO_TCP + ) except OSError as err: raise APIConnectionError("Error resolving IP address: {}".format(err))