99
1010from aiohttp import ClientConnectorError
1111import async_timeout
12- from reolink_aio .exceptions import ApiError , InvalidContentTypeError
12+ from reolink_aio .exceptions import (
13+ ApiError ,
14+ InvalidContentTypeError ,
15+ NoDataError ,
16+ ReolinkError ,
17+ )
1318
1419from homeassistant .config_entries import ConfigEntry
1520from homeassistant .const import EVENT_HOMEASSISTANT_STOP , Platform
1621from homeassistant .core import HomeAssistant
1722from homeassistant .exceptions import ConfigEntryAuthFailed , ConfigEntryNotReady
18- from homeassistant .helpers .update_coordinator import DataUpdateCoordinator
23+ from homeassistant .helpers .update_coordinator import DataUpdateCoordinator , UpdateFailed
1924
2025from .const import DOMAIN
2126from .exceptions import UserNotAdmin
@@ -53,6 +58,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
5358 asyncio .TimeoutError ,
5459 ApiError ,
5560 InvalidContentTypeError ,
61+ NoDataError ,
5662 ) as err :
5763 await host .stop ()
5864 raise ConfigEntryNotReady (
@@ -66,8 +72,12 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
6672 async def async_device_config_update ():
6773 """Update the host state cache and renew the ONVIF-subscription."""
6874 async with async_timeout .timeout (host .api .timeout ):
69- # Login session is implicitly updated here
70- await host .update_states ()
75+ try :
76+ await host .update_states ()
77+ except ReolinkError as err :
78+ raise UpdateFailed (
79+ f"Error updating Reolink { host .api .nvr_name } "
80+ ) from err
7181
7282 coordinator_device_config_update = DataUpdateCoordinator (
7383 hass ,
0 commit comments