From 1853c2d73a44e72b7db38632ad3fff930326116d Mon Sep 17 00:00:00 2001 From: Alistair Francis Date: Tue, 12 Mar 2024 03:58:43 +1000 Subject: [PATCH] components/gardena_bluetooth: Improve avaliability reliability (#113056) * components/gardena_bluetooth: Improve avaliability reliability The available() function incorrectly returns false even though the device is accessible. The last_update_success property should correctly indicate if the device isn't contactable, so we don't need to call async_address_present(). This is confirmed by seeing that no other users are calling async_address_present() in the available() function. This commit removes the call to async_address_present() to help fix the sensor being unavailable when using a ESPHome BLE proxy. Signed-off-by: Alistair Francis --------- Signed-off-by: Alistair Francis Co-authored-by: Joakim Plate --- .../components/gardena_bluetooth/coordinator.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/homeassistant/components/gardena_bluetooth/coordinator.py b/homeassistant/components/gardena_bluetooth/coordinator.py index 7d939d27eb5..296eff2686e 100644 --- a/homeassistant/components/gardena_bluetooth/coordinator.py +++ b/homeassistant/components/gardena_bluetooth/coordinator.py @@ -13,7 +13,6 @@ from gardena_bluetooth.exceptions import ( ) from gardena_bluetooth.parse import Characteristic, CharacteristicType -from homeassistant.components import bluetooth from homeassistant.core import HomeAssistant from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers.device_registry import DeviceInfo @@ -118,13 +117,7 @@ class GardenaBluetoothEntity(CoordinatorEntity[Coordinator]): @property def available(self) -> bool: """Return if entity is available.""" - return ( - self.coordinator.last_update_success - and bluetooth.async_address_present( - self.hass, self.coordinator.address, True - ) - and self._attr_available - ) + return self.coordinator.last_update_success and self._attr_available class GardenaBluetoothDescriptorEntity(GardenaBluetoothEntity):