Code quality improvements for Fully Kiosk (#80168)

This commit is contained in:
Franck Nijhof 2022-10-12 15:52:09 +02:00 committed by GitHub
parent 4a1c40f09b
commit 30920c3da7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 18 deletions

View file

@ -109,9 +109,9 @@ class FullySwitchEntity(FullyKioskEntity, SwitchEntity):
@property
def is_on(self) -> bool | None:
"""Return true if the entity is on."""
if self.entity_description.is_on_fn(self.coordinator.data) is not None:
return bool(self.entity_description.is_on_fn(self.coordinator.data))
return None
if (is_on := self.entity_description.is_on_fn(self.coordinator.data)) is None:
return None
return bool(is_on)
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn the entity on."""