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:
|
except UnicodeDecodeError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Service properties are always bytes if they are set from the network.
|
service_properties = service.properties
|
||||||
# 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)
|
|
||||||
|
|
||||||
border_agent_id = service_properties.get(b"id")
|
border_agent_id = service_properties.get(b"id")
|
||||||
model_name = try_decode(service_properties.get(b"mn"))
|
model_name = try_decode(service_properties.get(b"mn"))
|
||||||
network_name = try_decode(service_properties.get(b"nn"))
|
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
|
# data is not fully in the cache, so ignore for now
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Service properties are always bytes if they are set from the network.
|
service_properties = info.properties
|
||||||
# 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)
|
|
||||||
|
|
||||||
if not (xa := service_properties.get(b"xa")):
|
if not (xa := service_properties.get(b"xa")):
|
||||||
_LOGGER.debug("Ignoring record without xa %s", info)
|
_LOGGER.debug("Ignoring record without xa %s", info)
|
||||||
|
@ -189,10 +182,7 @@ class ThreadRouterDiscovery:
|
||||||
return
|
return
|
||||||
|
|
||||||
_LOGGER.debug("_add_update_service %s %s", name, service)
|
_LOGGER.debug("_add_update_service %s %s", name, service)
|
||||||
# Service properties are always bytes if they are set from the network.
|
service_properties = service.properties
|
||||||
# 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)
|
|
||||||
|
|
||||||
# We need xa and xp, bail out if either is missing
|
# We need xa and xp, bail out if either is missing
|
||||||
if not (xa := service_properties.get(b"xa")):
|
if not (xa := service_properties.get(b"xa")):
|
||||||
|
|
|
@ -128,12 +128,12 @@ class ZeroconfServiceInfo(BaseServiceInfo):
|
||||||
@property
|
@property
|
||||||
def host(self) -> str:
|
def host(self) -> str:
|
||||||
"""Return the host."""
|
"""Return the host."""
|
||||||
return _stringify_ip_address(self.ip_address)
|
return str(self.ip_address)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def addresses(self) -> list[str]:
|
def addresses(self) -> list[str]:
|
||||||
"""Return the addresses."""
|
"""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
|
@bind_hass
|
||||||
|
@ -338,12 +338,13 @@ def _match_against_data(
|
||||||
return True
|
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."""
|
"""Check a matcher to ensure all values in props."""
|
||||||
return not any(
|
return not any(
|
||||||
key
|
key
|
||||||
for key in matcher
|
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)
|
_LOGGER.debug("Failed to get addresses for device %s", name)
|
||||||
return
|
return
|
||||||
_LOGGER.debug("Discovered new device %s %s", name, info)
|
_LOGGER.debug("Discovered new device %s %s", name, info)
|
||||||
props: dict[str, str] = info.properties
|
props: dict[str, str | None] = info.properties
|
||||||
domain = None
|
domain = None
|
||||||
|
|
||||||
# If we can handle it as a HomeKit discovery, we do that here.
|
# If we can handle it as a HomeKit discovery, we do that here.
|
||||||
|
@ -563,10 +564,6 @@ def async_get_homekit_discovery(
|
||||||
return None
|
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:
|
def info_from_service(service: AsyncServiceInfo) -> ZeroconfServiceInfo | None:
|
||||||
"""Return prepared info from mDNS entries."""
|
"""Return prepared info from mDNS entries."""
|
||||||
# See https://ietf.org/rfc/rfc6763.html#section-6.4 and
|
# 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:
|
if not ip_address:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Service properties are always bytes if they are set from the network.
|
if TYPE_CHECKING:
|
||||||
# For legacy backwards compatibility zeroconf allows properties to be set
|
assert (
|
||||||
# as strings but we never do that so we can safely cast here.
|
service.server is not None
|
||||||
service_properties = cast(dict[bytes, bytes | None], service.properties)
|
), "server cannot be none if there are addresses"
|
||||||
|
|
||||||
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"
|
|
||||||
return ZeroconfServiceInfo(
|
return ZeroconfServiceInfo(
|
||||||
ip_address=ip_address,
|
ip_address=ip_address,
|
||||||
ip_addresses=ip_addresses,
|
ip_addresses=ip_addresses,
|
||||||
|
@ -606,7 +594,7 @@ def info_from_service(service: AsyncServiceInfo) -> ZeroconfServiceInfo | None:
|
||||||
hostname=service.server,
|
hostname=service.server,
|
||||||
type=service.type,
|
type=service.type,
|
||||||
name=service.name,
|
name=service.name,
|
||||||
properties=properties,
|
properties=service.decoded_properties,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,5 +8,5 @@
|
||||||
"iot_class": "local_push",
|
"iot_class": "local_push",
|
||||||
"loggers": ["zeroconf"],
|
"loggers": ["zeroconf"],
|
||||||
"quality_scale": "internal",
|
"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
|
voluptuous==0.13.1
|
||||||
webrtc-noise-gain==1.2.3
|
webrtc-noise-gain==1.2.3
|
||||||
yarl==1.9.4
|
yarl==1.9.4
|
||||||
zeroconf==0.128.5
|
zeroconf==0.129.0
|
||||||
|
|
||||||
# Constrain pycryptodome to avoid vulnerability
|
# Constrain pycryptodome to avoid vulnerability
|
||||||
# see https://github.com/home-assistant/core/pull/16238
|
# see https://github.com/home-assistant/core/pull/16238
|
||||||
|
|
|
@ -2832,7 +2832,7 @@ zamg==0.3.3
|
||||||
zengge==0.2
|
zengge==0.2
|
||||||
|
|
||||||
# homeassistant.components.zeroconf
|
# homeassistant.components.zeroconf
|
||||||
zeroconf==0.128.5
|
zeroconf==0.129.0
|
||||||
|
|
||||||
# homeassistant.components.zeversolar
|
# homeassistant.components.zeversolar
|
||||||
zeversolar==0.3.1
|
zeversolar==0.3.1
|
||||||
|
|
|
@ -2130,7 +2130,7 @@ yt-dlp==2023.11.16
|
||||||
zamg==0.3.3
|
zamg==0.3.3
|
||||||
|
|
||||||
# homeassistant.components.zeroconf
|
# homeassistant.components.zeroconf
|
||||||
zeroconf==0.128.5
|
zeroconf==0.129.0
|
||||||
|
|
||||||
# homeassistant.components.zeversolar
|
# homeassistant.components.zeversolar
|
||||||
zeversolar==0.3.1
|
zeversolar==0.3.1
|
||||||
|
|
Loading…
Reference in New Issue