Implement available property for Airthings BLE sensors (#96735)

This commit is contained in:
Seth 2023-10-22 15:02:15 -07:00 committed by GitHub
parent b980ed3eac
commit 4ee9a6f130
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -226,6 +226,14 @@ class AirthingsSensor(
model=airthings_device.model,
)
@property
def available(self) -> bool:
"""Check if device and sensor is available in data."""
return (
super().available
and self.entity_description.key in self.coordinator.data.sensors
)
@property
def native_value(self) -> StateType:
"""Return the value reported by the sensor."""