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
import async_timeout
from reolink_aio.api import RETRY_ATTEMPTS
from reolink_aio.exceptions import CredentialsInvalidError, ReolinkError
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:
"""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:
await host.update_states()
except ReolinkError as err:
raise UpdateFailed(
f"Error updating Reolink {host.api.nvr_name}"
) from err
raise UpdateFailed(str(err)) from err
async with async_timeout.timeout(host.api.timeout):
async with async_timeout.timeout(host.api.timeout * (RETRY_ATTEMPTS + 2)):
await host.renew()
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"):
return False
async with async_timeout.timeout(host.api.timeout):
async with async_timeout.timeout(host.api.timeout * (RETRY_ATTEMPTS + 2)):
try:
return await host.api.check_new_firmware()
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 .exceptions import ReolinkSetupException, ReolinkWebhookException, UserNotAdmin
DEFAULT_TIMEOUT = 60
DEFAULT_TIMEOUT = 30
FIRST_ONVIF_TIMEOUT = 10
FIRST_ONVIF_LONG_POLL_TIMEOUT = 90
SUBSCRIPTION_RENEW_THRESHOLD = 300
@ -470,7 +470,9 @@ class ReolinkHost:
await asyncio.sleep(LONG_POLL_ERROR_COOLDOWN)
continue
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)
raise ex

View file

@ -18,5 +18,5 @@
"documentation": "https://www.home-assistant.io/integrations/reolink",
"iot_class": "local_push",
"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
# homeassistant.components.reolink
reolink-aio==0.7.5
reolink-aio==0.7.6
# homeassistant.components.idteck_prox
rfk101py==0.0.1

View file

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