Bump reolink_aio to 0.7.6 + Timeout (#97464)

This commit is contained in:
starkillerOG 2023-07-31 21:01:25 +02:00 committed by GitHub
parent 094f2cbad7
commit 121fc7778d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 11 deletions

View File

@ -9,6 +9,7 @@ import logging
from typing import Literal from typing import Literal
import async_timeout import async_timeout
from reolink_aio.api import RETRY_ATTEMPTS
from reolink_aio.exceptions import CredentialsInvalidError, ReolinkError from reolink_aio.exceptions import CredentialsInvalidError, ReolinkError
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
@ -77,15 +78,13 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
async def async_device_config_update() -> None: async def async_device_config_update() -> None:
"""Update the host state cache and renew the ONVIF-subscription.""" """Update the host state cache and renew the ONVIF-subscription."""
async with async_timeout.timeout(host.api.timeout): async with async_timeout.timeout(host.api.timeout * (RETRY_ATTEMPTS + 2)):
try: try:
await host.update_states() await host.update_states()
except ReolinkError as err: except ReolinkError as err:
raise UpdateFailed( raise UpdateFailed(str(err)) from err
f"Error updating Reolink {host.api.nvr_name}"
) from err
async with async_timeout.timeout(host.api.timeout): async with async_timeout.timeout(host.api.timeout * (RETRY_ATTEMPTS + 2)):
await host.renew() await host.renew()
async def async_check_firmware_update() -> str | Literal[False]: async def async_check_firmware_update() -> str | Literal[False]:
@ -93,7 +92,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
if not host.api.supported(None, "update"): if not host.api.supported(None, "update"):
return False return False
async with async_timeout.timeout(host.api.timeout): async with async_timeout.timeout(host.api.timeout * (RETRY_ATTEMPTS + 2)):
try: try:
return await host.api.check_new_firmware() return await host.api.check_new_firmware()
except (ReolinkError, asyncio.exceptions.CancelledError) as err: except (ReolinkError, asyncio.exceptions.CancelledError) as err:

View File

@ -24,7 +24,7 @@ from homeassistant.helpers.network import NoURLAvailableError, get_url
from .const import CONF_PROTOCOL, CONF_USE_HTTPS, DOMAIN from .const import CONF_PROTOCOL, CONF_USE_HTTPS, DOMAIN
from .exceptions import ReolinkSetupException, ReolinkWebhookException, UserNotAdmin from .exceptions import ReolinkSetupException, ReolinkWebhookException, UserNotAdmin
DEFAULT_TIMEOUT = 60 DEFAULT_TIMEOUT = 30
FIRST_ONVIF_TIMEOUT = 10 FIRST_ONVIF_TIMEOUT = 10
FIRST_ONVIF_LONG_POLL_TIMEOUT = 90 FIRST_ONVIF_LONG_POLL_TIMEOUT = 90
SUBSCRIPTION_RENEW_THRESHOLD = 300 SUBSCRIPTION_RENEW_THRESHOLD = 300
@ -470,7 +470,9 @@ class ReolinkHost:
await asyncio.sleep(LONG_POLL_ERROR_COOLDOWN) await asyncio.sleep(LONG_POLL_ERROR_COOLDOWN)
continue continue
except Exception as ex: except Exception as ex:
_LOGGER.exception("Error while requesting ONVIF pull point: %s", ex) _LOGGER.exception(
"Unexpected exception while requesting ONVIF pull point: %s", ex
)
await self._api.unsubscribe(sub_type=SubType.long_poll) await self._api.unsubscribe(sub_type=SubType.long_poll)
raise ex raise ex

View File

@ -18,5 +18,5 @@
"documentation": "https://www.home-assistant.io/integrations/reolink", "documentation": "https://www.home-assistant.io/integrations/reolink",
"iot_class": "local_push", "iot_class": "local_push",
"loggers": ["reolink_aio"], "loggers": ["reolink_aio"],
"requirements": ["reolink-aio==0.7.5"] "requirements": ["reolink-aio==0.7.6"]
} }

View File

@ -2281,7 +2281,7 @@ renault-api==0.1.13
renson-endura-delta==1.5.0 renson-endura-delta==1.5.0
# homeassistant.components.reolink # homeassistant.components.reolink
reolink-aio==0.7.5 reolink-aio==0.7.6
# homeassistant.components.idteck_prox # homeassistant.components.idteck_prox
rfk101py==0.0.1 rfk101py==0.0.1

View File

@ -1677,7 +1677,7 @@ renault-api==0.1.13
renson-endura-delta==1.5.0 renson-endura-delta==1.5.0
# homeassistant.components.reolink # homeassistant.components.reolink
reolink-aio==0.7.5 reolink-aio==0.7.6
# homeassistant.components.rflink # homeassistant.components.rflink
rflink==0.0.65 rflink==0.0.65