From 8b5144f5f4e843ef02c066bf777be64a66da6bfb Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 16 Jul 2023 21:18:51 -1000 Subject: [PATCH] Remove workaround to populate missing handles (#301) --- aiohomekit/controller/ble/pairing.py | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/aiohomekit/controller/ble/pairing.py b/aiohomekit/controller/ble/pairing.py index cd347fa4..26f5020e 100644 --- a/aiohomekit/controller/ble/pairing.py +++ b/aiohomekit/controller/ble/pairing.py @@ -1073,20 +1073,6 @@ async def _async_populate_accessories_state( if self._restore_pending: await self._async_restore_subscriptions() - def _all_handles_are_missing(self) -> bool: - """Check if any characteristic has a handle. - - Older code did not save the handle, so if we have no handles - we need to re-fetch the gatt database. - """ - if not self.accessories.accessories: - return True - for service in self.accessories.aid(BLE_AID).services: - for char in service.characteristics: - if char.handle is not None: - return False - return True - async def _populate_accessories_and_characteristics( self, force_update: bool = False, attempts: int | None = None ) -> None: @@ -1121,11 +1107,7 @@ async def _populate_accessories_and_characteristics( if self.description: config_changed = self.config_num != self.description.config_num - if ( - not self.accessories - or config_changed - or self._all_handles_are_missing() - ): + if not self.accessories or config_changed: logger.debug( "%s: Fetching gatt database because, cached_config_num: %s, adv config_num: %s", self.name,