mirror of
https://github.com/esphome/esphome.git
synced 2025-10-27 13:13:50 +00:00
[core] handle mixed IP and DNS addresses correctly in resolve_ip_address
do not raise error if some addresses are IPs and the mDNS / DNS resolution fails for others fix: #11501
This commit is contained in:
@@ -250,6 +250,9 @@ def resolve_ip_address(
|
||||
|
||||
# If we have uncached hosts (only non-IP hostnames), resolve them
|
||||
if uncached_hosts:
|
||||
from esphome.core import EsphomeError
|
||||
|
||||
try:
|
||||
from esphome.resolver import AsyncResolver
|
||||
|
||||
resolver = AsyncResolver(uncached_hosts, port)
|
||||
@@ -278,6 +281,11 @@ def resolve_ip_address(
|
||||
sockaddr_tuple,
|
||||
)
|
||||
)
|
||||
except EsphomeError as err:
|
||||
if len(res) > 0:
|
||||
_LOGGER.warning(err)
|
||||
else:
|
||||
raise err
|
||||
|
||||
# Sort by preference
|
||||
res.sort(key=addr_preference_)
|
||||
|
||||
Reference in New Issue
Block a user