From 19c26b79afb08268286c5fdc93d0d00a8c6d52e2 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 8 May 2024 17:45:57 -0500 Subject: [PATCH] Move available property in BasePassiveBluetoothCoordinator to PassiveBluetoothDataUpdateCoordinator (#117056) --- .../components/bluetooth/passive_update_coordinator.py | 5 +++++ .../components/bluetooth/passive_update_processor.py | 2 +- homeassistant/components/bluetooth/update_coordinator.py | 5 ----- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/bluetooth/passive_update_coordinator.py b/homeassistant/components/bluetooth/passive_update_coordinator.py index 81a67f6caef..75e5910554b 100644 --- a/homeassistant/components/bluetooth/passive_update_coordinator.py +++ b/homeassistant/components/bluetooth/passive_update_coordinator.py @@ -48,6 +48,11 @@ class PassiveBluetoothDataUpdateCoordinator( super().__init__(hass, logger, address, mode, connectable) self._listeners: dict[CALLBACK_TYPE, tuple[CALLBACK_TYPE, object | None]] = {} + @property + def available(self) -> bool: + """Return if device is available.""" + return self._available + @callback def async_update_listeners(self) -> None: """Update all registered listeners.""" diff --git a/homeassistant/components/bluetooth/passive_update_processor.py b/homeassistant/components/bluetooth/passive_update_processor.py index e7a902f4db0..230c810999f 100644 --- a/homeassistant/components/bluetooth/passive_update_processor.py +++ b/homeassistant/components/bluetooth/passive_update_processor.py @@ -311,7 +311,7 @@ class PassiveBluetoothProcessorCoordinator( @property def available(self) -> bool: """Return if the device is available.""" - return super().available and self.last_update_success + return self._available and self.last_update_success @callback def async_get_restore_data( diff --git a/homeassistant/components/bluetooth/update_coordinator.py b/homeassistant/components/bluetooth/update_coordinator.py index eb2f8c0cf82..880824aeccf 100644 --- a/homeassistant/components/bluetooth/update_coordinator.py +++ b/homeassistant/components/bluetooth/update_coordinator.py @@ -83,11 +83,6 @@ class BasePassiveBluetoothCoordinator(ABC): # was set when the unavailable callback was called. return self._last_unavailable_time - @property - def available(self) -> bool: - """Return if the device is available.""" - return self._available - @callback def _async_start(self) -> None: """Start the callbacks."""