Bump ZHA dependencies (#130563)

pull/130713/head
puddly 2024-11-15 03:55:22 -05:00 committed by Franck Nijhof
parent 53e38454b2
commit 95d60987ab
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
5 changed files with 17 additions and 18 deletions

View File

@ -21,7 +21,7 @@
"zha", "zha",
"universal_silabs_flasher" "universal_silabs_flasher"
], ],
"requirements": ["universal-silabs-flasher==0.0.24", "zha==0.0.37"], "requirements": ["universal-silabs-flasher==0.0.25", "zha==0.0.39"],
"usb": [ "usb": [
{ {
"vid": "10C4", "vid": "10C4",

View File

@ -4,7 +4,6 @@ from __future__ import annotations
import functools import functools
import logging import logging
import math
from typing import Any from typing import Any
from zha.exceptions import ZHAException from zha.exceptions import ZHAException
@ -97,6 +96,7 @@ class ZHAFirmwareUpdateEntity(
| UpdateEntityFeature.SPECIFIC_VERSION | UpdateEntityFeature.SPECIFIC_VERSION
| UpdateEntityFeature.RELEASE_NOTES | UpdateEntityFeature.RELEASE_NOTES
) )
_attr_display_precision = 2 # 40 byte chunks with ~200KB files increments by 0.02%
def __init__(self, entity_data: EntityData, **kwargs: Any) -> None: def __init__(self, entity_data: EntityData, **kwargs: Any) -> None:
"""Initialize the ZHA siren.""" """Initialize the ZHA siren."""
@ -115,20 +115,19 @@ class ZHAFirmwareUpdateEntity(
def in_progress(self) -> bool | int | None: def in_progress(self) -> bool | int | None:
"""Update installation progress. """Update installation progress.
Should return a boolean (True if in progress, False if not).
"""
return self.entity_data.entity.in_progress
@property
def update_percentage(self) -> int | float | None:
"""Update installation progress.
Needs UpdateEntityFeature.PROGRESS flag to be set for it to be used. Needs UpdateEntityFeature.PROGRESS flag to be set for it to be used.
Can either return a boolean (True if in progress, False if not) Can either return a number to indicate the progress from 0 to 100% or None.
or an integer to indicate the progress in from 0 to 100%.
""" """
if not self.entity_data.entity.in_progress: return self.entity_data.entity.update_percentage
return self.entity_data.entity.in_progress
# Stay in an indeterminate state until we actually send something
if self.entity_data.entity.progress == 0:
return True
# Rescale 0-100% to 2-100% to avoid 0 and 1 colliding with None, False, and True
return int(math.ceil(2 + 98 * self.entity_data.entity.progress / 100))
@property @property
def latest_version(self) -> str | None: def latest_version(self) -> str | None:

View File

@ -2900,7 +2900,7 @@ unifi_ap==0.0.1
unifiled==0.11 unifiled==0.11
# homeassistant.components.zha # homeassistant.components.zha
universal-silabs-flasher==0.0.24 universal-silabs-flasher==0.0.25
# homeassistant.components.upb # homeassistant.components.upb
upb-lib==0.5.8 upb-lib==0.5.8
@ -3066,7 +3066,7 @@ zeroconf==0.136.0
zeversolar==0.3.2 zeversolar==0.3.2
# homeassistant.components.zha # homeassistant.components.zha
zha==0.0.37 zha==0.0.39
# homeassistant.components.zhong_hong # homeassistant.components.zhong_hong
zhong-hong-hvac==1.0.13 zhong-hong-hvac==1.0.13

View File

@ -2307,7 +2307,7 @@ ultraheat-api==0.5.7
unifi-discovery==1.2.0 unifi-discovery==1.2.0
# homeassistant.components.zha # homeassistant.components.zha
universal-silabs-flasher==0.0.24 universal-silabs-flasher==0.0.25
# homeassistant.components.upb # homeassistant.components.upb
upb-lib==0.5.8 upb-lib==0.5.8
@ -2449,7 +2449,7 @@ zeroconf==0.136.0
zeversolar==0.3.2 zeversolar==0.3.2
# homeassistant.components.zha # homeassistant.components.zha
zha==0.0.37 zha==0.0.39
# homeassistant.components.zwave_js # homeassistant.components.zwave_js
zwave-js-server-python==0.58.1 zwave-js-server-python==0.58.1

View File

@ -394,7 +394,7 @@ async def test_firmware_update_success(
attrs[ATTR_INSTALLED_VERSION] == f"0x{installed_fw_version:08x}" attrs[ATTR_INSTALLED_VERSION] == f"0x{installed_fw_version:08x}"
) )
assert attrs[ATTR_IN_PROGRESS] is True assert attrs[ATTR_IN_PROGRESS] is True
assert attrs[ATTR_UPDATE_PERCENTAGE] == 58 assert attrs[ATTR_UPDATE_PERCENTAGE] == pytest.approx(100 * 40 / 70)
assert ( assert (
attrs[ATTR_LATEST_VERSION] attrs[ATTR_LATEST_VERSION]
== f"0x{fw_image.firmware.header.file_version:08x}" == f"0x{fw_image.firmware.header.file_version:08x}"