diff --git a/custom_components/auto_backup/__init__.py b/custom_components/auto_backup/__init__.py index d6e280e..8f2b235 100644 --- a/custom_components/auto_backup/__init__.py +++ b/custom_components/auto_backup/__init__.py @@ -33,9 +33,7 @@ EVENT_BACKUPS_PURGED, EVENT_BACKUP_SUCCESSFUL, EVENT_BACKUP_START, - UNSUB_LISTENER, DATA_AUTO_BACKUP, - DEFAULT_BACKUP_TIMEOUT_SECONDS, CONF_AUTO_PURGE, CONF_BACKUP_TIMEOUT, DEFAULT_BACKUP_TIMEOUT, @@ -316,7 +314,7 @@ def validate_backup_config(self, config: Dict): if ATTR_INCLUDE in config or ATTR_EXCLUDE in config: raise HomeAssistantError( - f"Partial backups (e.g. include/exclude) are not supported on non-supervised installations." + "Partial backups (e.g. include/exclude) are not supported on non-supervised installations." ) if config.get(ATTR_NAME): diff --git a/custom_components/auto_backup/handlers.py b/custom_components/auto_backup/handlers.py index 2188e8b..456c16f 100644 --- a/custom_components/auto_backup/handlers.py +++ b/custom_components/auto_backup/handlers.py @@ -6,7 +6,6 @@ from typing import Dict, List, Optional import aiohttp -import async_timeout from aiohttp.hdrs import AUTHORIZATION from homeassistant.components.backup import BackupManager from homeassistant.const import ATTR_NAME @@ -79,7 +78,7 @@ async def send_command(self, command, method="post", payload=None, timeout=10): This method is a coroutine. """ try: - with async_timeout.timeout(timeout): + async with asyncio.timeout(timeout): request = await self._session.request( method, f"http://{self._ip}{command}", @@ -95,7 +94,7 @@ async def send_command(self, command, method="post", payload=None, timeout=10): answer = await request.json() return answer - except asyncio.TimeoutError: + except TimeoutError: raise HassioAPIError("Timeout on %s request" % command) except aiohttp.ClientError as err: @@ -131,7 +130,7 @@ async def download_backup( command = f"/backups/{slug}/download" try: - with async_timeout.timeout(timeout): + async with asyncio.timeout(timeout): request = await self._session.request( "get", f"http://{self._ip}{command}", @@ -153,7 +152,7 @@ async def download_backup( _LOGGER.info("Downloaded backup '%s' to '%s'", slug, destination) return - except asyncio.TimeoutError: + except TimeoutError: _LOGGER.error("Timeout on %s request", command) except aiohttp.ClientError as err: diff --git a/hacs.json b/hacs.json index be5f1e6..07fed50 100644 --- a/hacs.json +++ b/hacs.json @@ -3,5 +3,5 @@ "zip_release": true, "hide_default_branch": true, "filename": "auto_backup.zip", - "homeassistant": "2022.4.0" + "homeassistant": "2023.4.0" }