From 4ee9a6f1301d34c2f287038ebf0c3acdc5f93517 Mon Sep 17 00:00:00 2001 From: Seth <48533968+WillCodeForCats@users.noreply.github.com> Date: Sun, 22 Oct 2023 15:02:15 -0700 Subject: [PATCH] Implement available property for Airthings BLE sensors (#96735) --- homeassistant/components/airthings_ble/sensor.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/homeassistant/components/airthings_ble/sensor.py b/homeassistant/components/airthings_ble/sensor.py index 28b5fa3a7a6..aaeb91cf30b 100644 --- a/homeassistant/components/airthings_ble/sensor.py +++ b/homeassistant/components/airthings_ble/sensor.py @@ -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."""