Replace async_timeout with asyncio.timeout A-B (#98415)
This commit is contained in:
parent
eb4745012a
commit
262483f3f6
27 changed files with 52 additions and 55 deletions
|
@ -1,6 +1,7 @@
|
|||
"""The AccuWeather component."""
|
||||
from __future__ import annotations
|
||||
|
||||
from asyncio import timeout
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any
|
||||
|
@ -8,7 +9,6 @@ from typing import Any
|
|||
from accuweather import AccuWeather, ApiError, InvalidApiKeyError, RequestsExceededError
|
||||
from aiohttp import ClientSession
|
||||
from aiohttp.client_exceptions import ClientConnectorError
|
||||
from async_timeout import timeout
|
||||
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_PLATFORM
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from asyncio import timeout
|
||||
from typing import Any
|
||||
|
||||
from accuweather import AccuWeather, ApiError, InvalidApiKeyError, RequestsExceededError
|
||||
from aiohttp import ClientError
|
||||
from aiohttp.client_exceptions import ClientConnectorError
|
||||
from async_timeout import timeout
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from asyncio import timeout
|
||||
from contextlib import suppress
|
||||
from typing import Any
|
||||
|
||||
import aiopulse
|
||||
import async_timeout
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries
|
||||
|
@ -43,7 +43,7 @@ class AcmedaFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
hubs: list[aiopulse.Hub] = []
|
||||
with suppress(asyncio.TimeoutError):
|
||||
async with async_timeout.timeout(5):
|
||||
async with timeout(5):
|
||||
async for hub in aiopulse.Hub.discover():
|
||||
if hub.id not in already_configured:
|
||||
hubs.append(hub)
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
"""Support for Automation Device Specification (ADS)."""
|
||||
import asyncio
|
||||
from asyncio import timeout
|
||||
from collections import namedtuple
|
||||
import ctypes
|
||||
import logging
|
||||
import struct
|
||||
import threading
|
||||
|
||||
import async_timeout
|
||||
import pyads
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -301,7 +301,7 @@ class AdsEntity(Entity):
|
|||
self._ads_hub.add_device_notification, ads_var, plctype, update
|
||||
)
|
||||
try:
|
||||
async with async_timeout.timeout(10):
|
||||
async with timeout(10):
|
||||
await self._event.wait()
|
||||
except asyncio.TimeoutError:
|
||||
_LOGGER.debug("Variable %s: Timeout during first update", ads_var)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Weather data coordinator for the AEMET OpenData service."""
|
||||
from __future__ import annotations
|
||||
|
||||
from asyncio import timeout
|
||||
from dataclasses import dataclass, field
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
@ -41,7 +42,6 @@ from aemet_opendata.helpers import (
|
|||
get_forecast_hour_value,
|
||||
get_forecast_interval_value,
|
||||
)
|
||||
import async_timeout
|
||||
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
@ -139,7 +139,7 @@ class WeatherUpdateCoordinator(DataUpdateCoordinator):
|
|||
|
||||
async def _async_update_data(self):
|
||||
data = {}
|
||||
async with async_timeout.timeout(120):
|
||||
async with timeout(120):
|
||||
weather_response = await self._get_aemet_weather()
|
||||
data = self._convert_weather_response(weather_response)
|
||||
return data
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""The Airly integration."""
|
||||
from __future__ import annotations
|
||||
|
||||
from asyncio import timeout
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from math import ceil
|
||||
|
@ -9,7 +10,6 @@ from aiohttp import ClientSession
|
|||
from aiohttp.client_exceptions import ClientConnectorError
|
||||
from airly import Airly
|
||||
from airly.exceptions import AirlyError
|
||||
import async_timeout
|
||||
|
||||
from homeassistant.components.air_quality import DOMAIN as AIR_QUALITY_PLATFORM
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
@ -167,7 +167,7 @@ class AirlyDataUpdateCoordinator(DataUpdateCoordinator):
|
|||
measurements = self.airly.create_measurements_session_point(
|
||||
self.latitude, self.longitude
|
||||
)
|
||||
async with async_timeout.timeout(20):
|
||||
async with timeout(20):
|
||||
try:
|
||||
await measurements.update()
|
||||
except (AirlyError, ClientConnectorError) as error:
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
"""Adds config flow for Airly."""
|
||||
from __future__ import annotations
|
||||
|
||||
from asyncio import timeout
|
||||
from http import HTTPStatus
|
||||
from typing import Any
|
||||
|
||||
from aiohttp import ClientSession
|
||||
from airly import Airly
|
||||
from airly.exceptions import AirlyError
|
||||
import async_timeout
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries
|
||||
|
@ -105,7 +105,7 @@ async def test_location(
|
|||
measurements = airly.create_measurements_session_point(
|
||||
latitude=latitude, longitude=longitude
|
||||
)
|
||||
async with async_timeout.timeout(10):
|
||||
async with timeout(10):
|
||||
await measurements.update()
|
||||
|
||||
current = measurements.current
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
"""The Airzone integration."""
|
||||
from __future__ import annotations
|
||||
|
||||
from asyncio import timeout
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from aioairzone.exceptions import AirzoneError
|
||||
from aioairzone.localapi import AirzoneLocalApi
|
||||
import async_timeout
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
|
@ -35,7 +35,7 @@ class AirzoneUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
|||
|
||||
async def _async_update_data(self) -> dict[str, Any]:
|
||||
"""Update data via library."""
|
||||
async with async_timeout.timeout(AIOAIRZONE_DEVICE_TIMEOUT_SEC):
|
||||
async with timeout(AIOAIRZONE_DEVICE_TIMEOUT_SEC):
|
||||
try:
|
||||
await self.airzone.update()
|
||||
except AirzoneError as error:
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
"""The Airzone Cloud integration coordinator."""
|
||||
from __future__ import annotations
|
||||
|
||||
from asyncio import timeout
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from aioairzone_cloud.cloudapi import AirzoneCloudApi
|
||||
from aioairzone_cloud.exceptions import AirzoneCloudError
|
||||
import async_timeout
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
|
@ -35,7 +35,7 @@ class AirzoneUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
|||
|
||||
async def _async_update_data(self) -> dict[str, Any]:
|
||||
"""Update data via library."""
|
||||
async with async_timeout.timeout(AIOAIRZONE_CLOUD_TIMEOUT_SEC):
|
||||
async with timeout(AIOAIRZONE_CLOUD_TIMEOUT_SEC):
|
||||
try:
|
||||
await self.airzone.update()
|
||||
except AirzoneCloudError as error:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""Support for Alexa skill auth."""
|
||||
import asyncio
|
||||
from asyncio import timeout
|
||||
from datetime import datetime, timedelta
|
||||
from http import HTTPStatus
|
||||
import json
|
||||
|
@ -7,7 +8,6 @@ import logging
|
|||
from typing import Any
|
||||
|
||||
import aiohttp
|
||||
import async_timeout
|
||||
|
||||
from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
|
@ -113,7 +113,7 @@ class Auth:
|
|||
async def _async_request_new_token(self, lwa_params: dict[str, str]) -> str | None:
|
||||
try:
|
||||
session = aiohttp_client.async_get_clientsession(self.hass)
|
||||
async with async_timeout.timeout(10):
|
||||
async with timeout(10):
|
||||
response = await session.post(
|
||||
LWA_TOKEN_URI,
|
||||
headers=LWA_HEADERS,
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from asyncio import timeout
|
||||
from http import HTTPStatus
|
||||
import json
|
||||
import logging
|
||||
|
@ -10,7 +11,6 @@ from typing import TYPE_CHECKING, Any, cast
|
|||
from uuid import uuid4
|
||||
|
||||
import aiohttp
|
||||
import async_timeout
|
||||
|
||||
from homeassistant.components import event
|
||||
from homeassistant.const import MATCH_ALL, STATE_ON
|
||||
|
@ -364,7 +364,7 @@ async def async_send_changereport_message(
|
|||
|
||||
assert config.endpoint is not None
|
||||
try:
|
||||
async with async_timeout.timeout(DEFAULT_TIMEOUT):
|
||||
async with timeout(DEFAULT_TIMEOUT):
|
||||
response = await session.post(
|
||||
config.endpoint,
|
||||
headers=headers,
|
||||
|
@ -517,7 +517,7 @@ async def async_send_doorbell_event_message(
|
|||
|
||||
assert config.endpoint is not None
|
||||
try:
|
||||
async with async_timeout.timeout(DEFAULT_TIMEOUT):
|
||||
async with timeout(DEFAULT_TIMEOUT):
|
||||
response = await session.post(
|
||||
config.endpoint,
|
||||
headers=headers,
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from asyncio import timeout
|
||||
from dataclasses import asdict as dataclass_asdict, dataclass
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
import uuid
|
||||
|
||||
import aiohttp
|
||||
import async_timeout
|
||||
|
||||
from homeassistant.components import hassio
|
||||
from homeassistant.components.api import ATTR_INSTALLATION_TYPE
|
||||
|
@ -313,7 +313,7 @@ class Analytics:
|
|||
)
|
||||
|
||||
try:
|
||||
async with async_timeout.timeout(30):
|
||||
async with timeout(30):
|
||||
response = await self.session.post(self.endpoint, json=payload)
|
||||
if response.status == 200:
|
||||
LOGGER.info(
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from asyncio import timeout
|
||||
import logging
|
||||
|
||||
from androidtvremote2 import (
|
||||
|
@ -10,7 +11,6 @@ from androidtvremote2 import (
|
|||
ConnectionClosed,
|
||||
InvalidAuth,
|
||||
)
|
||||
import async_timeout
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME, EVENT_HOMEASSISTANT_STOP, Platform
|
||||
|
@ -45,7 +45,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
api.add_is_available_updated_callback(is_available_updated)
|
||||
|
||||
try:
|
||||
async with async_timeout.timeout(5.0):
|
||||
async with timeout(5.0):
|
||||
await api.async_connect()
|
||||
except InvalidAuth as exc:
|
||||
# The Android TV is hard reset or the certificate and key files were deleted.
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
"""Support for Anova Coordinators."""
|
||||
from asyncio import timeout
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from anova_wifi import AnovaOffline, AnovaPrecisionCooker, APCUpdate
|
||||
import async_timeout
|
||||
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
|
@ -47,7 +47,7 @@ class AnovaCoordinator(DataUpdateCoordinator[APCUpdate]):
|
|||
|
||||
async def _async_update_data(self) -> APCUpdate:
|
||||
try:
|
||||
async with async_timeout.timeout(5):
|
||||
async with timeout(5):
|
||||
return await self.anova_device.update()
|
||||
except AnovaOffline as err:
|
||||
raise UpdateFailed(err) from err
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
"""Rest API for Home Assistant."""
|
||||
import asyncio
|
||||
from asyncio import timeout
|
||||
from functools import lru_cache
|
||||
from http import HTTPStatus
|
||||
import logging
|
||||
|
||||
from aiohttp import web
|
||||
from aiohttp.web_exceptions import HTTPBadRequest
|
||||
import async_timeout
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.auth.permissions.const import POLICY_READ
|
||||
|
@ -148,7 +148,7 @@ class APIEventStream(HomeAssistantView):
|
|||
|
||||
while True:
|
||||
try:
|
||||
async with async_timeout.timeout(STREAM_PING_INTERVAL):
|
||||
async with timeout(STREAM_PING_INTERVAL):
|
||||
payload = await to_write.get()
|
||||
|
||||
if payload is stop_obj:
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
"""Arcam component."""
|
||||
import asyncio
|
||||
from asyncio import timeout
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from arcam.fmj import ConnectionFailed
|
||||
from arcam.fmj.client import Client
|
||||
import async_timeout
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT, Platform
|
||||
|
@ -66,7 +66,7 @@ async def _run_client(hass: HomeAssistant, client: Client, interval: float) -> N
|
|||
|
||||
while True:
|
||||
try:
|
||||
async with async_timeout.timeout(interval):
|
||||
async with timeout(interval):
|
||||
await client.start()
|
||||
|
||||
_LOGGER.debug("Client connected %s", client.host)
|
||||
|
|
|
@ -7,7 +7,6 @@ from collections.abc import AsyncGenerator, Callable
|
|||
import logging
|
||||
from typing import Any
|
||||
|
||||
import async_timeout
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import conversation, stt, tts, websocket_api
|
||||
|
@ -207,7 +206,7 @@ async def websocket_run(
|
|||
|
||||
try:
|
||||
# Task contains a timeout
|
||||
async with async_timeout.timeout(timeout):
|
||||
async with asyncio.timeout(timeout):
|
||||
await run_task
|
||||
except asyncio.TimeoutError:
|
||||
pipeline_input.run.process_event(
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""The ATAG Integration."""
|
||||
from asyncio import timeout
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
import async_timeout
|
||||
from pyatag import AtagException, AtagOne
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
@ -27,7 +27,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
|
||||
async def _async_update_data():
|
||||
"""Update data via library."""
|
||||
async with async_timeout.timeout(20):
|
||||
async with timeout(20):
|
||||
try:
|
||||
await atag.update()
|
||||
except AtagException as err:
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
"""The awair component."""
|
||||
from __future__ import annotations
|
||||
|
||||
from asyncio import gather
|
||||
from asyncio import gather, timeout
|
||||
from dataclasses import dataclass
|
||||
from datetime import timedelta
|
||||
|
||||
from aiohttp import ClientSession
|
||||
from async_timeout import timeout
|
||||
from python_awair import Awair, AwairLocal
|
||||
from python_awair.air_data import AirData
|
||||
from python_awair.devices import AwairBaseDevice, AwairLocalDevice
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
"""Axis network device abstraction."""
|
||||
|
||||
import asyncio
|
||||
from asyncio import timeout
|
||||
from types import MappingProxyType
|
||||
from typing import Any
|
||||
|
||||
import async_timeout
|
||||
import axis
|
||||
from axis.configuration import Configuration
|
||||
from axis.errors import Unauthorized
|
||||
|
@ -253,7 +253,7 @@ async def get_axis_device(
|
|||
)
|
||||
|
||||
try:
|
||||
async with async_timeout.timeout(30):
|
||||
async with timeout(30):
|
||||
await device.vapix.initialize()
|
||||
|
||||
return device
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from asyncio import timeout
|
||||
|
||||
from aiobafi6 import Device, Service
|
||||
from aiobafi6.discovery import PORT
|
||||
import async_timeout
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_IP_ADDRESS, Platform
|
||||
|
@ -35,7 +35,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
run_future = device.async_run()
|
||||
|
||||
try:
|
||||
async with async_timeout.timeout(RUN_TIMEOUT):
|
||||
async with timeout(RUN_TIMEOUT):
|
||||
await device.async_wait_available()
|
||||
except asyncio.TimeoutError as ex:
|
||||
run_future.cancel()
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from asyncio import timeout
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from aiobafi6 import Device, Service
|
||||
from aiobafi6.discovery import PORT
|
||||
import async_timeout
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries
|
||||
|
@ -27,7 +27,7 @@ async def async_try_connect(ip_address: str) -> Device:
|
|||
device = Device(Service(ip_addresses=[ip_address], port=PORT))
|
||||
run_future = device.async_run()
|
||||
try:
|
||||
async with async_timeout.timeout(RUN_TIMEOUT):
|
||||
async with timeout(RUN_TIMEOUT):
|
||||
await device.async_wait_available()
|
||||
except asyncio.TimeoutError as ex:
|
||||
raise CannotConnect from ex
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from asyncio import CancelledError
|
||||
from asyncio import CancelledError, timeout
|
||||
from datetime import timedelta
|
||||
from http import HTTPStatus
|
||||
import logging
|
||||
|
@ -12,7 +12,6 @@ from urllib import parse
|
|||
import aiohttp
|
||||
from aiohttp.client_exceptions import ClientError
|
||||
from aiohttp.hdrs import CONNECTION, KEEP_ALIVE
|
||||
import async_timeout
|
||||
import voluptuous as vol
|
||||
import xmltodict
|
||||
|
||||
|
@ -355,7 +354,7 @@ class BluesoundPlayer(MediaPlayerEntity):
|
|||
|
||||
try:
|
||||
websession = async_get_clientsession(self._hass)
|
||||
async with async_timeout.timeout(10):
|
||||
async with timeout(10):
|
||||
response = await websession.get(url)
|
||||
|
||||
if response.status == HTTPStatus.OK:
|
||||
|
@ -396,7 +395,7 @@ class BluesoundPlayer(MediaPlayerEntity):
|
|||
_LOGGER.debug("Calling URL: %s", url)
|
||||
|
||||
try:
|
||||
async with async_timeout.timeout(125):
|
||||
async with timeout(125):
|
||||
response = await self._polling_session.get(
|
||||
url, headers={CONNECTION: KEEP_ALIVE}
|
||||
)
|
||||
|
|
|
@ -4,11 +4,11 @@ These APIs are the only documented way to interact with the bluetooth integratio
|
|||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from asyncio import Future
|
||||
from collections.abc import Callable, Iterable
|
||||
from typing import TYPE_CHECKING, cast
|
||||
|
||||
import async_timeout
|
||||
from home_assistant_bluetooth import BluetoothServiceInfoBleak
|
||||
|
||||
from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback as hass_callback
|
||||
|
@ -152,7 +152,7 @@ async def async_process_advertisements(
|
|||
)
|
||||
|
||||
try:
|
||||
async with async_timeout.timeout(timeout):
|
||||
async with asyncio.timeout(timeout):
|
||||
return await done
|
||||
finally:
|
||||
unload()
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
"""The Brother component."""
|
||||
from __future__ import annotations
|
||||
|
||||
from asyncio import timeout
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
import async_timeout
|
||||
from brother import Brother, BrotherSensors, SnmpError, UnsupportedModelError
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
@ -79,7 +79,7 @@ class BrotherDataUpdateCoordinator(DataUpdateCoordinator[BrotherSensors]):
|
|||
async def _async_update_data(self) -> BrotherSensors:
|
||||
"""Update data via library."""
|
||||
try:
|
||||
async with async_timeout.timeout(20):
|
||||
async with timeout(20):
|
||||
data = await self.brother.async_update()
|
||||
except (ConnectionError, SnmpError, UnsupportedModelError) as error:
|
||||
raise UpdateFailed(error) from error
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
"""The brunt component."""
|
||||
from __future__ import annotations
|
||||
|
||||
from asyncio import timeout
|
||||
import logging
|
||||
|
||||
from aiohttp.client_exceptions import ClientResponseError, ServerDisconnectedError
|
||||
import async_timeout
|
||||
from brunt import BruntClientAsync, Thing
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
@ -43,7 +43,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
Error 401 is the API response for things that are not part of the account, could happen when a device is deleted from the account.
|
||||
"""
|
||||
try:
|
||||
async with async_timeout.timeout(10):
|
||||
async with timeout(10):
|
||||
things = await bapi.async_get_things(force=True)
|
||||
return {thing.serial: thing for thing in things}
|
||||
except ServerDisconnectedError as err:
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
"""Shared utilities for different supported platforms."""
|
||||
import asyncio
|
||||
from asyncio import timeout
|
||||
from datetime import datetime, timedelta
|
||||
from http import HTTPStatus
|
||||
import logging
|
||||
|
||||
import aiohttp
|
||||
import async_timeout
|
||||
from buienradar.buienradar import parse_data
|
||||
from buienradar.constants import (
|
||||
ATTRIBUTION,
|
||||
|
@ -92,7 +92,7 @@ class BrData:
|
|||
resp = None
|
||||
try:
|
||||
websession = async_get_clientsession(self.hass)
|
||||
async with async_timeout.timeout(10):
|
||||
async with timeout(10):
|
||||
resp = await websession.get(url)
|
||||
|
||||
result[STATUS_CODE] = resp.status
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue