Reduce attribute lookups in update state_attributes (#96511)
This commit is contained in:
parent
7ccb06ed22
commit
70c88a125c
1 changed files with 9 additions and 9 deletions
|
@ -375,25 +375,25 @@ class UpdateEntity(RestoreEntity):
|
|||
else:
|
||||
in_progress = self.__in_progress
|
||||
|
||||
installed_version = self.installed_version
|
||||
latest_version = self.latest_version
|
||||
skipped_version = self.__skipped_version
|
||||
# Clear skipped version in case it matches the current installed
|
||||
# version or the latest version diverged.
|
||||
if (
|
||||
self.installed_version is not None
|
||||
and self.__skipped_version == self.installed_version
|
||||
) or (
|
||||
self.latest_version is not None
|
||||
and self.__skipped_version != self.latest_version
|
||||
if (installed_version is not None and skipped_version == installed_version) or (
|
||||
latest_version is not None and skipped_version != latest_version
|
||||
):
|
||||
skipped_version = None
|
||||
self.__skipped_version = None
|
||||
|
||||
return {
|
||||
ATTR_AUTO_UPDATE: self.auto_update,
|
||||
ATTR_INSTALLED_VERSION: self.installed_version,
|
||||
ATTR_INSTALLED_VERSION: installed_version,
|
||||
ATTR_IN_PROGRESS: in_progress,
|
||||
ATTR_LATEST_VERSION: self.latest_version,
|
||||
ATTR_LATEST_VERSION: latest_version,
|
||||
ATTR_RELEASE_SUMMARY: release_summary,
|
||||
ATTR_RELEASE_URL: self.release_url,
|
||||
ATTR_SKIPPED_VERSION: self.__skipped_version,
|
||||
ATTR_SKIPPED_VERSION: skipped_version,
|
||||
ATTR_TITLE: self.title,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue