From 85c5667ee62b91e91b9186656ddeace7edfac013 Mon Sep 17 00:00:00 2001 From: Tucker Kern Date: Wed, 17 Jul 2024 16:00:01 -0600 Subject: [PATCH] Use coordinator's available property instead of checking device directly --- custom_components/midea_ac/number.py | 2 +- custom_components/midea_ac/select.py | 2 +- custom_components/midea_ac/sensor.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/custom_components/midea_ac/number.py b/custom_components/midea_ac/number.py index eaa4ee0..2c3b284 100644 --- a/custom_components/midea_ac/number.py +++ b/custom_components/midea_ac/number.py @@ -63,7 +63,7 @@ def unique_id(self) -> str: @property def available(self) -> bool: """Check device availability.""" - return self._device.online and self._device.power_state + return super().available and self._device.power_state @property def native_unit_of_measurement(self) -> str: diff --git a/custom_components/midea_ac/select.py b/custom_components/midea_ac/select.py index f5664f1..8e6ea53 100644 --- a/custom_components/midea_ac/select.py +++ b/custom_components/midea_ac/select.py @@ -81,7 +81,7 @@ def unique_id(self) -> str: @property def available(self) -> bool: """Check device availability.""" - return self._device.online and self._device.power_state + return super().available and self._device.power_state @property def current_option(self) -> str: diff --git a/custom_components/midea_ac/sensor.py b/custom_components/midea_ac/sensor.py index f1e8743..4e0efeb 100644 --- a/custom_components/midea_ac/sensor.py +++ b/custom_components/midea_ac/sensor.py @@ -117,7 +117,7 @@ def available(self) -> bool: """Check entity availability.""" # Sensor is unavailable if device is offline or value is None - return self._device.online and self.native_value is not None + return super().available and self.native_value is not None @property def device_class(self) -> str: