Improve typing in fans and locks (#73901)

This commit is contained in:
epenet 2022-06-23 16:34:40 +02:00 committed by GitHub
parent ff7d840a6c
commit 3c82c718cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 27 additions and 26 deletions

View file

@ -35,12 +35,12 @@ class StarlineLock(StarlineEntity, LockEntity):
super().__init__(account, device, "lock", "Security")
@property
def available(self):
def available(self) -> bool:
"""Return True if entity is available."""
return super().available and self._device.online
@property
def extra_state_attributes(self):
def extra_state_attributes(self) -> dict[str, bool]:
"""Return the state attributes of the lock.
Possible dictionary keys:
@ -61,7 +61,7 @@ class StarlineLock(StarlineEntity, LockEntity):
return self._device.alarm_state
@property
def icon(self):
def icon(self) -> str:
"""Icon to use in the frontend, if any."""
return (
"mdi:shield-check-outline" if self.is_locked else "mdi:shield-alert-outline"