Bump reolink-aio to 0.3.0 (#86259)

* Bump reolink-aio to 0.3.0

* fix typo

* ReolinkException
This commit is contained in:
starkillerOG 2023-01-20 08:05:43 +01:00 committed by GitHub
parent 4be7b62607
commit 3c4455c696
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 38 additions and 60 deletions

View file

@ -12,8 +12,10 @@ import async_timeout
from reolink_aio.exceptions import (
ApiError,
InvalidContentTypeError,
LoginError,
NoDataError,
ReolinkError,
UnexpectedDataError,
)
from homeassistant.config_entries import ConfigEntry
@ -23,7 +25,7 @@ from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from .const import DOMAIN
from .exceptions import UserNotAdmin
from .exceptions import ReolinkException, UserNotAdmin
from .host import ReolinkHost
_LOGGER = logging.getLogger(__name__)
@ -45,12 +47,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
host = ReolinkHost(hass, config_entry.data, config_entry.options)
try:
if not await host.async_init():
await host.stop()
raise ConfigEntryNotReady(
f"Error while trying to setup {host.api.host}:{host.api.port}: "
"failed to obtain data from device."
)
await host.async_init()
except UserNotAdmin as err:
raise ConfigEntryAuthFailed(err) from UserNotAdmin
except (
@ -58,7 +55,10 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
asyncio.TimeoutError,
ApiError,
InvalidContentTypeError,
LoginError,
NoDataError,
ReolinkException,
UnexpectedDataError,
) as err:
await host.stop()
raise ConfigEntryNotReady(