mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2024-12-27 17:37:39 +01:00
Use zeroconf resolver for .local domains first
This commit is contained in:
parent
2f499c71d1
commit
0e813dfd44
@ -50,11 +50,11 @@ async def resolve_ip_address_getaddrinfo(eventloop: asyncio.events.AbstractEvent
|
||||
|
||||
async def resolve_ip_address(eventloop: asyncio.events.AbstractEventLoop,
|
||||
host: str, port: int) -> Tuple[Any, ...]:
|
||||
try:
|
||||
return await resolve_ip_address_getaddrinfo(eventloop, host, port)
|
||||
except APIConnectionError as err:
|
||||
if host.endswith('.local'):
|
||||
from aioesphomeapi.host_resolver import resolve_host
|
||||
if host.endswith('.local'):
|
||||
from aioesphomeapi.host_resolver import resolve_host
|
||||
|
||||
try:
|
||||
return await eventloop.run_in_executor(None, resolve_host, host), port
|
||||
raise err
|
||||
except APIConnectionError:
|
||||
pass
|
||||
return await resolve_ip_address_getaddrinfo(eventloop, host, port)
|
||||
|
Loading…
Reference in New Issue
Block a user