Bump zeroconf to 0.52.0 (#90660)
* Bump zeroconf to 0.52.0 Switch to using the new ip_addresses_by_version which avoids all the ip address conversions * updates
This commit is contained in:
parent
4a4d3201f5
commit
17270979e6
5 changed files with 13 additions and 32 deletions
|
@ -564,14 +564,19 @@ def info_from_service(service: AsyncServiceInfo) -> ZeroconfServiceInfo | None:
|
|||
if isinstance(value, bytes):
|
||||
properties[key] = value.decode("utf-8")
|
||||
|
||||
if not (addresses := service.addresses or service.parsed_addresses()):
|
||||
if not (ip_addresses := service.ip_addresses_by_version(IPVersion.All)):
|
||||
return None
|
||||
if (host := _first_non_link_local_address(addresses)) is None:
|
||||
host: str | None = None
|
||||
for ip_addr in ip_addresses:
|
||||
if not ip_addr.is_link_local and not ip_addr.is_unspecified:
|
||||
host = str(ip_addr)
|
||||
break
|
||||
if not host:
|
||||
return None
|
||||
|
||||
return ZeroconfServiceInfo(
|
||||
host=str(host),
|
||||
addresses=service.parsed_addresses(),
|
||||
host=host,
|
||||
addresses=[str(ip_addr) for ip_addr in ip_addresses],
|
||||
port=service.port,
|
||||
hostname=service.server,
|
||||
type=service.type,
|
||||
|
@ -580,30 +585,6 @@ def info_from_service(service: AsyncServiceInfo) -> ZeroconfServiceInfo | None:
|
|||
)
|
||||
|
||||
|
||||
def _first_non_link_local_address(
|
||||
addresses: list[bytes] | list[str],
|
||||
) -> str | None:
|
||||
"""Return the first ipv6 or non-link local ipv4 address, preferring IPv4."""
|
||||
for address in addresses:
|
||||
ip_addr = ip_address(address)
|
||||
if (
|
||||
not ip_addr.is_link_local
|
||||
and not ip_addr.is_unspecified
|
||||
and ip_addr.version == 4
|
||||
):
|
||||
return str(ip_addr)
|
||||
# If we didn't find a good IPv4 address, check for IPv6 addresses.
|
||||
for address in addresses:
|
||||
ip_addr = ip_address(address)
|
||||
if (
|
||||
not ip_addr.is_link_local
|
||||
and not ip_addr.is_unspecified
|
||||
and ip_addr.version == 6
|
||||
):
|
||||
return str(ip_addr)
|
||||
return None
|
||||
|
||||
|
||||
def _suppress_invalid_properties(properties: dict) -> None:
|
||||
"""Suppress any properties that will cause zeroconf to fail to startup."""
|
||||
|
||||
|
|
|
@ -8,5 +8,5 @@
|
|||
"iot_class": "local_push",
|
||||
"loggers": ["zeroconf"],
|
||||
"quality_scale": "internal",
|
||||
"requirements": ["zeroconf==0.51.0"]
|
||||
"requirements": ["zeroconf==0.52.0"]
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ ulid-transform==0.5.1
|
|||
voluptuous-serialize==2.6.0
|
||||
voluptuous==0.13.1
|
||||
yarl==1.8.1
|
||||
zeroconf==0.51.0
|
||||
zeroconf==0.52.0
|
||||
|
||||
# Constrain pycryptodome to avoid vulnerability
|
||||
# see https://github.com/home-assistant/core/pull/16238
|
||||
|
|
|
@ -2695,7 +2695,7 @@ zamg==0.2.2
|
|||
zengge==0.2
|
||||
|
||||
# homeassistant.components.zeroconf
|
||||
zeroconf==0.51.0
|
||||
zeroconf==0.52.0
|
||||
|
||||
# homeassistant.components.zeversolar
|
||||
zeversolar==0.3.1
|
||||
|
|
|
@ -1938,7 +1938,7 @@ youless-api==1.0.1
|
|||
zamg==0.2.2
|
||||
|
||||
# homeassistant.components.zeroconf
|
||||
zeroconf==0.51.0
|
||||
zeroconf==0.52.0
|
||||
|
||||
# homeassistant.components.zeversolar
|
||||
zeversolar==0.3.1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue