mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Report update_percentage in smlight update entity (#129383)
This commit is contained in:
parent
e34fab0045
commit
3a59a862d5
@ -153,9 +153,8 @@ class SmUpdateEntity(SmEntity, UpdateEntity):
|
||||
"""Update install progress on event."""
|
||||
|
||||
progress = int(progress.data)
|
||||
if progress > 1:
|
||||
self._attr_in_progress = progress
|
||||
self.async_write_ha_state()
|
||||
self._attr_update_percentage = progress
|
||||
self.async_write_ha_state()
|
||||
|
||||
def _update_done(self) -> None:
|
||||
"""Handle cleanup for update done."""
|
||||
@ -166,6 +165,10 @@ class SmUpdateEntity(SmEntity, UpdateEntity):
|
||||
remove_cb()
|
||||
self._unload.clear()
|
||||
|
||||
self._attr_in_progress = False
|
||||
self._attr_update_percentage = None
|
||||
self.async_write_ha_state()
|
||||
|
||||
@callback
|
||||
def _update_finished(self, event: MessageEvent) -> None:
|
||||
"""Handle event for update finished."""
|
||||
@ -186,6 +189,7 @@ class SmUpdateEntity(SmEntity, UpdateEntity):
|
||||
if not self.coordinator.in_progress and self._firmware:
|
||||
self.coordinator.in_progress = True
|
||||
self._attr_in_progress = True
|
||||
self._attr_update_percentage = None
|
||||
self.register_callbacks()
|
||||
|
||||
await self.coordinator.client.fw_update(self._firmware)
|
||||
|
Loading…
x
Reference in New Issue
Block a user