Bump ZHA dependencies (#130563)

pull/130670/head
puddly 2024-11-15 03:55:22 -05:00 committed by GitHub
parent 0a2535cf8f
commit 390b83a963
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 17 additions and 18 deletions

View File

@ -21,7 +21,7 @@
"zha",
"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": [
{
"vid": "10C4",

View File

@ -4,7 +4,6 @@ from __future__ import annotations
import functools
import logging
import math
from typing import Any
from zha.exceptions import ZHAException
@ -97,6 +96,7 @@ class ZHAFirmwareUpdateEntity(
| UpdateEntityFeature.SPECIFIC_VERSION
| 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:
"""Initialize the ZHA siren."""
@ -115,20 +115,19 @@ class ZHAFirmwareUpdateEntity(
def in_progress(self) -> bool | int | None:
"""Update installation progress.
Needs UpdateEntityFeature.PROGRESS flag to be set for it to be used.
Can either return a boolean (True if in progress, False if not)
or an integer to indicate the progress in from 0 to 100%.
Should return a boolean (True if in progress, False if not).
"""
if not self.entity_data.entity.in_progress:
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
@property
def update_percentage(self) -> int | float | None:
"""Update installation progress.
# 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))
Needs UpdateEntityFeature.PROGRESS flag to be set for it to be used.
Can either return a number to indicate the progress from 0 to 100% or None.
"""
return self.entity_data.entity.update_percentage
@property
def latest_version(self) -> str | None:

View File

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

View File

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

View File

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