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" _attr_unique_id = "updater"
@property @property
def is_on(self) -> bool | None: def available(self) -> bool:
"""Return true if the binary sensor is on.""" """Return if entity is available."""
if not self.coordinator.data: return True
return None
return self.coordinator.data.update_available @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 @property
def extra_state_attributes(self) -> dict | None: def extra_state_attributes(self) -> dict | None: