Skip to content

Commit

Permalink
Handle TimeoutError exception when trying to connect on init
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronen Gruengras committed Nov 13, 2024
1 parent 0ab0329 commit e3e83d6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion custom_components/hass_nuki_bt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""
from __future__ import annotations
import logging
from asyncio import CancelledError, TimeoutError
from bleak import BleakError

from homeassistant.config_entries import ConfigEntry
Expand Down Expand Up @@ -73,7 +74,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
)
try:
await device.connect()
except BleakError:
except (BleakError, CancelledError, TimeoutError) as ex:
_LOGGER.debug(ex)
raise ConfigEntryNotReady(f"Could not connect to {address}")

hass.data[DOMAIN][entry.entry_id] = coordinator = NukiDataUpdateCoordinator(
Expand Down

0 comments on commit e3e83d6

Please sign in to comment.