Report update_percentage in esphome update entity (#129376)

This commit is contained in:
Erik Montnemery 2024-10-29 17:51:54 +01:00 committed by GitHub
parent 3a59a862d5
commit ecbb417736
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -230,10 +230,8 @@ class ESPHomeUpdateEntity(EsphomeEntity[UpdateInfo, UpdateState], UpdateEntity):
@property
@esphome_state_property
def in_progress(self) -> bool | int | None:
def in_progress(self) -> bool:
"""Return if the update is in progress."""
if self._state.has_progress:
return int(self._state.progress)
return self._state.in_progress
@property
@ -260,6 +258,14 @@ class ESPHomeUpdateEntity(EsphomeEntity[UpdateInfo, UpdateState], UpdateEntity):
"""Return the title of the update."""
return self._state.title
@property
@esphome_state_property
def update_percentage(self) -> int | None:
"""Return if the update is in progress."""
if self._state.has_progress:
return int(self._state.progress)
return None
@convert_api_error_ha_error
async def async_update(self) -> None:
"""Command device to check for update."""