Report update_percentage in tessie update entity (#129385)

This commit is contained in:
Erik Montnemery 2024-10-29 17:48:29 +01:00 committed by GitHub
parent 7254ebe0e3
commit e34fab0045
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -71,14 +71,22 @@ class TessieUpdateEntity(TessieEntity, UpdateEntity):
return self.installed_version return self.installed_version
@property @property
def in_progress(self) -> bool | int | None: def in_progress(self) -> bool:
"""Update installation progress."""
return (
self.get("vehicle_state_software_update_status")
== TessieUpdateStatus.INSTALLING
)
@property
def update_percentage(self) -> int | None:
"""Update installation progress.""" """Update installation progress."""
if ( if (
self.get("vehicle_state_software_update_status") self.get("vehicle_state_software_update_status")
== TessieUpdateStatus.INSTALLING == TessieUpdateStatus.INSTALLING
): ):
return self.get("vehicle_state_software_update_install_perc") return self.get("vehicle_state_software_update_install_perc")
return False return None
async def async_install( async def async_install(
self, version: str | None, backup: bool, **kwargs: Any self, version: str | None, backup: bool, **kwargs: Any