mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 07:07:28 +00:00
Report update_percentage in matter update entity (#129380)
This commit is contained in:
parent
bf840e8bfa
commit
9e2696b9bc
@ -100,21 +100,23 @@ class MatterUpdate(MatterEntity, UpdateEntity):
|
|||||||
== clusters.OtaSoftwareUpdateRequestor.Enums.UpdateStateEnum.kIdle
|
== clusters.OtaSoftwareUpdateRequestor.Enums.UpdateStateEnum.kIdle
|
||||||
):
|
):
|
||||||
self._attr_in_progress = False
|
self._attr_in_progress = False
|
||||||
|
self._attr_update_percentage = None
|
||||||
return
|
return
|
||||||
|
|
||||||
update_progress: int = self.get_matter_attribute_value(
|
update_progress: int = self.get_matter_attribute_value(
|
||||||
clusters.OtaSoftwareUpdateRequestor.Attributes.UpdateStateProgress
|
clusters.OtaSoftwareUpdateRequestor.Attributes.UpdateStateProgress
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self._attr_in_progress = True
|
||||||
if (
|
if (
|
||||||
update_state
|
update_state
|
||||||
== clusters.OtaSoftwareUpdateRequestor.Enums.UpdateStateEnum.kDownloading
|
== clusters.OtaSoftwareUpdateRequestor.Enums.UpdateStateEnum.kDownloading
|
||||||
and update_progress is not None
|
and update_progress is not None
|
||||||
and update_progress > 0
|
and update_progress > 0
|
||||||
):
|
):
|
||||||
self._attr_in_progress = update_progress
|
self._attr_update_percentage = update_progress
|
||||||
else:
|
else:
|
||||||
self._attr_in_progress = True
|
self._attr_update_percentage = None
|
||||||
|
|
||||||
async def async_update(self) -> None:
|
async def async_update(self) -> None:
|
||||||
"""Call when the entity needs to be updated."""
|
"""Call when the entity needs to be updated."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user