Set brand icon as entity picture on update entities (#69200)

Co-authored-by: Joakim Sørensen <ludeeus@ludeeus.dev>
This commit is contained in:
Franck Nijhof 2022-04-03 20:38:05 +02:00 committed by GitHub
parent bd1d7bdbb7
commit b644e7ed0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 8 deletions

View file

@ -208,6 +208,20 @@ class UpdateEntity(RestoreEntity):
return EntityCategory.CONFIG
return EntityCategory.DIAGNOSTIC
@property
def entity_picture(self) -> str | None:
"""Return the entity picture to use in the frontend.
Update entities return the brand icon based on the integration
domain by default.
"""
if self.platform is None:
return None
return (
f"https://brands.home-assistant.io/_/{self.platform.platform_name}/icon.png"
)
@property
def in_progress(self) -> bool | int | None:
"""Update installation progress.