mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Bump zeroconf to 0.74.0 (#97745)
* Bump zeroconf to 0.74.0 changelog: https://github.com/python-zeroconf/python-zeroconf/compare/0.72.3...0.74.0 - more cython build fixes - performance improvements (mostly for pyatv) * handle typing * handle typing * remove if TYPE_CHECKING, this doesnt get called that often * remove if TYPE_CHECKING, this doesnt get called that often
This commit is contained in:
parent
ddb384c2ed
commit
d1f8309423
@ -57,25 +57,29 @@ def async_discovery_data_from_service(
|
|||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
ext_addr = service.properties.get(b"xa")
|
# Service properties are always bytes if they are set from the network.
|
||||||
ext_pan_id = service.properties.get(b"xp")
|
# For legacy backwards compatibility zeroconf allows properties to be set
|
||||||
network_name = try_decode(service.properties.get(b"nn"))
|
# as strings but we never do that so we can safely cast here.
|
||||||
model_name = try_decode(service.properties.get(b"mn"))
|
service_properties = cast(dict[bytes, bytes | None], service.properties)
|
||||||
|
ext_addr = service_properties.get(b"xa")
|
||||||
|
ext_pan_id = service_properties.get(b"xp")
|
||||||
|
network_name = try_decode(service_properties.get(b"nn"))
|
||||||
|
model_name = try_decode(service_properties.get(b"mn"))
|
||||||
server = service.server
|
server = service.server
|
||||||
vendor_name = try_decode(service.properties.get(b"vn"))
|
vendor_name = try_decode(service_properties.get(b"vn"))
|
||||||
thread_version = try_decode(service.properties.get(b"tv"))
|
thread_version = try_decode(service_properties.get(b"tv"))
|
||||||
unconfigured = None
|
unconfigured = None
|
||||||
brand = KNOWN_BRANDS.get(vendor_name)
|
brand = KNOWN_BRANDS.get(vendor_name)
|
||||||
if brand == "homeassistant":
|
if brand == "homeassistant":
|
||||||
# Attempt to detect incomplete configuration
|
# Attempt to detect incomplete configuration
|
||||||
if (state_bitmap_b := service.properties.get(b"sb")) is not None:
|
if (state_bitmap_b := service_properties.get(b"sb")) is not None:
|
||||||
try:
|
try:
|
||||||
state_bitmap = StateBitmap.from_bytes(state_bitmap_b)
|
state_bitmap = StateBitmap.from_bytes(state_bitmap_b)
|
||||||
if not state_bitmap.is_active:
|
if not state_bitmap.is_active:
|
||||||
unconfigured = True
|
unconfigured = True
|
||||||
except ValueError:
|
except ValueError:
|
||||||
_LOGGER.debug("Failed to decode state bitmap in service %s", service)
|
_LOGGER.debug("Failed to decode state bitmap in service %s", service)
|
||||||
if service.properties.get(b"at") is None:
|
if service_properties.get(b"at") is None:
|
||||||
unconfigured = True
|
unconfigured = True
|
||||||
|
|
||||||
return ThreadRouterDiscoveryData(
|
return ThreadRouterDiscoveryData(
|
||||||
@ -168,10 +172,19 @@ 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.
|
||||||
|
# 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)
|
||||||
|
|
||||||
|
if not (xa := service_properties.get(b"xa")):
|
||||||
|
_LOGGER.debug("_add_update_service failed to find xa in %s", service)
|
||||||
|
return
|
||||||
|
|
||||||
# We use the extended mac address as key, bail out if it's missing
|
# We use the extended mac address as key, bail out if it's missing
|
||||||
try:
|
try:
|
||||||
extended_mac_address = service.properties[b"xa"].hex()
|
extended_mac_address = xa.hex()
|
||||||
except (KeyError, UnicodeDecodeError) as err:
|
except UnicodeDecodeError as err:
|
||||||
_LOGGER.debug("_add_update_service failed to parse service %s", err)
|
_LOGGER.debug("_add_update_service failed to parse service %s", err)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -553,11 +553,17 @@ def info_from_service(service: AsyncServiceInfo) -> ZeroconfServiceInfo | None:
|
|||||||
break
|
break
|
||||||
if not host:
|
if not host:
|
||||||
return None
|
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] = {
|
properties: dict[str, Any] = {
|
||||||
k.decode("ascii", "replace"): None
|
k.decode("ascii", "replace"): None
|
||||||
if v is None
|
if v is None
|
||||||
else v.decode("utf-8", "replace")
|
else v.decode("utf-8", "replace")
|
||||||
for k, v in service.properties.items()
|
for k, v in service_properties.items()
|
||||||
}
|
}
|
||||||
|
|
||||||
assert service.server is not None, "server cannot be none if there are addresses"
|
assert service.server is not None, "server cannot be none if there are addresses"
|
||||||
|
@ -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.72.3"]
|
"requirements": ["zeroconf==0.74.0"]
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ voluptuous-serialize==2.6.0
|
|||||||
voluptuous==0.13.1
|
voluptuous==0.13.1
|
||||||
webrtcvad==2.0.10
|
webrtcvad==2.0.10
|
||||||
yarl==1.9.2
|
yarl==1.9.2
|
||||||
zeroconf==0.72.3
|
zeroconf==0.74.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
|
||||||
|
@ -2752,7 +2752,7 @@ zamg==0.2.4
|
|||||||
zengge==0.2
|
zengge==0.2
|
||||||
|
|
||||||
# homeassistant.components.zeroconf
|
# homeassistant.components.zeroconf
|
||||||
zeroconf==0.72.3
|
zeroconf==0.74.0
|
||||||
|
|
||||||
# homeassistant.components.zeversolar
|
# homeassistant.components.zeversolar
|
||||||
zeversolar==0.3.1
|
zeversolar==0.3.1
|
||||||
|
@ -2025,7 +2025,7 @@ youtubeaio==1.1.5
|
|||||||
zamg==0.2.4
|
zamg==0.2.4
|
||||||
|
|
||||||
# homeassistant.components.zeroconf
|
# homeassistant.components.zeroconf
|
||||||
zeroconf==0.72.3
|
zeroconf==0.74.0
|
||||||
|
|
||||||
# homeassistant.components.zeversolar
|
# homeassistant.components.zeversolar
|
||||||
zeversolar==0.3.1
|
zeversolar==0.3.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user