1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-27 05:03:48 +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:
Links2004
2025-10-23 17:15:45 +00:00
parent 917deac7cb
commit af321edf80

View File

@@ -250,6 +250,9 @@ def resolve_ip_address(
# If we have uncached hosts (only non-IP hostnames), resolve them # If we have uncached hosts (only non-IP hostnames), resolve them
if uncached_hosts: if uncached_hosts:
from esphome.core import EsphomeError
try:
from esphome.resolver import AsyncResolver from esphome.resolver import AsyncResolver
resolver = AsyncResolver(uncached_hosts, port) resolver = AsyncResolver(uncached_hosts, port)
@@ -278,6 +281,11 @@ def resolve_ip_address(
sockaddr_tuple, sockaddr_tuple,
) )
) )
except EsphomeError as err:
if len(res) > 0:
_LOGGER.warning(err)
else:
raise err
# Sort by preference # Sort by preference
res.sort(key=addr_preference_) res.sort(key=addr_preference_)