Improve Airzone Cloud sensors availability (#123383)

airzone_cloud: improve sensors availability

Make sensor entities unavailable instead of providing an unknown state.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
This commit is contained in:
Álvaro Fernández Rojas 2024-08-08 19:23:52 +02:00 committed by GitHub
parent b498c89860
commit 634a2b22dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View File

@ -161,6 +161,11 @@ class AirzoneBinarySensor(AirzoneEntity, BinarySensorEntity):
entity_description: AirzoneBinarySensorEntityDescription
@property
def available(self) -> bool:
"""Return Airzone Cloud binary sensor availability."""
return super().available and self.is_on is not None
@callback
def _handle_coordinator_update(self) -> None:
"""Update attributes when the coordinator updates."""

View File

@ -189,6 +189,11 @@ async def async_setup_entry(
class AirzoneSensor(AirzoneEntity, SensorEntity):
"""Define an Airzone Cloud sensor."""
@property
def available(self) -> bool:
"""Return Airzone Cloud sensor availability."""
return super().available and self.native_value is not None
@callback
def _handle_coordinator_update(self) -> None:
"""Update attributes when the coordinator updates."""