Always show state for the updater binary_sensor (#55584)

This commit is contained in:
Joakim Sørensen 2021-09-03 17:40:07 +02:00 committed by GitHub
parent 4310a7d814
commit 2171922265
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,11 +26,14 @@ class UpdaterBinary(CoordinatorEntity, BinarySensorEntity):
_attr_unique_id = "updater"
@property
def is_on(self) -> bool | None:
"""Return true if the binary sensor is on."""
if not self.coordinator.data:
return None
return self.coordinator.data.update_available
def available(self) -> bool:
"""Return if entity is available."""
return True
@property
def is_on(self) -> bool:
"""Return true if there is an update available."""
return self.coordinator.data and self.coordinator.data.update_available
@property
def extra_state_attributes(self) -> dict | None: