diff --git a/homeassistant/components/switchbot/coordinator.py b/homeassistant/components/switchbot/coordinator.py index ad9aff8c53b..e4e7c25dc70 100644 --- a/homeassistant/components/switchbot/coordinator.py +++ b/homeassistant/components/switchbot/coordinator.py @@ -2,9 +2,11 @@ from __future__ import annotations import asyncio +import contextlib import logging from typing import TYPE_CHECKING, Any +import async_timeout import switchbot from homeassistant.components import bluetooth @@ -71,8 +73,8 @@ class SwitchbotDataUpdateCoordinator(PassiveBluetoothDataUpdateCoordinator): async def async_wait_ready(self) -> bool: """Wait for the device to be ready.""" - try: - await asyncio.wait_for(self._ready_event.wait(), timeout=55) - except asyncio.TimeoutError: - return False - return True + with contextlib.suppress(asyncio.TimeoutError): + async with async_timeout.timeout(55): + await self._ready_event.wait() + return True + return False