Bump zeroconf to 0.129.0 (#105701)
* Bump zeroconf to 0.129.0 changelog: https://github.com/python-zeroconf/python-zeroconf/compare/0.128.5...0.129.0 * cleanup typing * remove redunant lru * revert type narrowingpull/105717/head
parent
a16ab0d1ac
commit
aafdca88c9
|
@ -60,11 +60,7 @@ def async_discovery_data_from_service(
|
|||
except UnicodeDecodeError:
|
||||
return None
|
||||
|
||||
# Service properties are always bytes if they are set from the network.
|
||||
# For legacy backwards compatibility zeroconf allows properties to be set
|
||||
# as strings but we never do that so we can safely cast here.
|
||||
service_properties = cast(dict[bytes, bytes | None], service.properties)
|
||||
|
||||
service_properties = service.properties
|
||||
border_agent_id = service_properties.get(b"id")
|
||||
model_name = try_decode(service_properties.get(b"mn"))
|
||||
network_name = try_decode(service_properties.get(b"nn"))
|
||||
|
@ -121,10 +117,7 @@ def async_read_zeroconf_cache(aiozc: AsyncZeroconf) -> list[ThreadRouterDiscover
|
|||
# data is not fully in the cache, so ignore for now
|
||||
continue
|
||||
|
||||
# Service properties are always bytes if they are set from the network.
|
||||
# For legacy backwards compatibility zeroconf allows properties to be set
|
||||
# as strings but we never do that so we can safely cast here.
|
||||
service_properties = cast(dict[bytes, bytes | None], info.properties)
|
||||
service_properties = info.properties
|
||||
|
||||
if not (xa := service_properties.get(b"xa")):
|
||||
_LOGGER.debug("Ignoring record without xa %s", info)
|
||||
|
@ -189,10 +182,7 @@ class ThreadRouterDiscovery:
|
|||
return
|
||||
|
||||
_LOGGER.debug("_add_update_service %s %s", name, service)
|
||||
# Service properties are always bytes if they are set from the network.
|
||||
# For legacy backwards compatibility zeroconf allows properties to be set
|
||||
# as strings but we never do that so we can safely cast here.
|
||||
service_properties = cast(dict[bytes, bytes | None], service.properties)
|
||||
service_properties = service.properties
|
||||
|
||||
# We need xa and xp, bail out if either is missing
|
||||
if not (xa := service_properties.get(b"xa")):
|
||||
|
|
|
@ -128,12 +128,12 @@ class ZeroconfServiceInfo(BaseServiceInfo):
|
|||
@property
|
||||
def host(self) -> str:
|
||||
"""Return the host."""
|
||||
return _stringify_ip_address(self.ip_address)
|
||||
return str(self.ip_address)
|
||||
|
||||
@property
|
||||
def addresses(self) -> list[str]:
|
||||
"""Return the addresses."""
|
||||
return [_stringify_ip_address(ip_address) for ip_address in self.ip_addresses]
|
||||
return [str(ip_address) for ip_address in self.ip_addresses]
|
||||
|
||||
|
||||
@bind_hass
|
||||
|
@ -338,12 +338,13 @@ def _match_against_data(
|
|||
return True
|
||||
|
||||
|
||||
def _match_against_props(matcher: dict[str, str], props: dict[str, str]) -> bool:
|
||||
def _match_against_props(matcher: dict[str, str], props: dict[str, str | None]) -> bool:
|
||||
"""Check a matcher to ensure all values in props."""
|
||||
return not any(
|
||||
key
|
||||
for key in matcher
|
||||
if key not in props or not _memorized_fnmatch(props[key].lower(), matcher[key])
|
||||
if key not in props
|
||||
or not _memorized_fnmatch((props[key] or "").lower(), matcher[key])
|
||||
)
|
||||
|
||||
|
||||
|
@ -467,7 +468,7 @@ class ZeroconfDiscovery:
|
|||
_LOGGER.debug("Failed to get addresses for device %s", name)
|
||||
return
|
||||
_LOGGER.debug("Discovered new device %s %s", name, info)
|
||||
props: dict[str, str] = info.properties
|
||||
props: dict[str, str | None] = info.properties
|
||||
domain = None
|
||||
|
||||
# If we can handle it as a HomeKit discovery, we do that here.
|
||||
|
@ -563,10 +564,6 @@ def async_get_homekit_discovery(
|
|||
return None
|
||||
|
||||
|
||||
# matches to the cache in zeroconf itself
|
||||
_stringify_ip_address = lru_cache(maxsize=256)(str)
|
||||
|
||||
|
||||
def info_from_service(service: AsyncServiceInfo) -> ZeroconfServiceInfo | None:
|
||||
"""Return prepared info from mDNS entries."""
|
||||
# See https://ietf.org/rfc/rfc6763.html#section-6.4 and
|
||||
|
@ -586,19 +583,10 @@ def info_from_service(service: AsyncServiceInfo) -> ZeroconfServiceInfo | None:
|
|||
if not ip_address:
|
||||
return None
|
||||
|
||||
# Service properties are always bytes if they are set from the network.
|
||||
# For legacy backwards compatibility zeroconf allows properties to be set
|
||||
# as strings but we never do that so we can safely cast here.
|
||||
service_properties = cast(dict[bytes, bytes | None], service.properties)
|
||||
|
||||
properties: dict[str, Any] = {
|
||||
k.decode("ascii", "replace"): None
|
||||
if v is None
|
||||
else v.decode("utf-8", "replace")
|
||||
for k, v in service_properties.items()
|
||||
}
|
||||
|
||||
assert service.server is not None, "server cannot be none if there are addresses"
|
||||
if TYPE_CHECKING:
|
||||
assert (
|
||||
service.server is not None
|
||||
), "server cannot be none if there are addresses"
|
||||
return ZeroconfServiceInfo(
|
||||
ip_address=ip_address,
|
||||
ip_addresses=ip_addresses,
|
||||
|
@ -606,7 +594,7 @@ def info_from_service(service: AsyncServiceInfo) -> ZeroconfServiceInfo | None:
|
|||
hostname=service.server,
|
||||
type=service.type,
|
||||
name=service.name,
|
||||
properties=properties,
|
||||
properties=service.decoded_properties,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -8,5 +8,5 @@
|
|||
"iot_class": "local_push",
|
||||
"loggers": ["zeroconf"],
|
||||
"quality_scale": "internal",
|
||||
"requirements": ["zeroconf==0.128.5"]
|
||||
"requirements": ["zeroconf==0.129.0"]
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ voluptuous-serialize==2.6.0
|
|||
voluptuous==0.13.1
|
||||
webrtc-noise-gain==1.2.3
|
||||
yarl==1.9.4
|
||||
zeroconf==0.128.5
|
||||
zeroconf==0.129.0
|
||||
|
||||
# Constrain pycryptodome to avoid vulnerability
|
||||
# see https://github.com/home-assistant/core/pull/16238
|
||||
|
|
|
@ -2832,7 +2832,7 @@ zamg==0.3.3
|
|||
zengge==0.2
|
||||
|
||||
# homeassistant.components.zeroconf
|
||||
zeroconf==0.128.5
|
||||
zeroconf==0.129.0
|
||||
|
||||
# homeassistant.components.zeversolar
|
||||
zeversolar==0.3.1
|
||||
|
|
|
@ -2130,7 +2130,7 @@ yt-dlp==2023.11.16
|
|||
zamg==0.3.3
|
||||
|
||||
# homeassistant.components.zeroconf
|
||||
zeroconf==0.128.5
|
||||
zeroconf==0.129.0
|
||||
|
||||
# homeassistant.components.zeversolar
|
||||
zeversolar==0.3.1
|
||||
|
|
Loading…
Reference in New Issue