Use builtin TimeoutError [t-z] (#109683)
This commit is contained in:
parent
438d3b01b9
commit
8b0c9d3d18
63 changed files with 88 additions and 122 deletions
|
@ -94,7 +94,7 @@ class FlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
auth_url = await self.hass.async_add_executor_job(self._get_auth_url)
|
auth_url = await self.hass.async_add_executor_job(self._get_auth_url)
|
||||||
if not auth_url:
|
if not auth_url:
|
||||||
return self.async_abort(reason="unknown_authorize_url_generation")
|
return self.async_abort(reason="unknown_authorize_url_generation")
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
return self.async_abort(reason="authorize_url_timeout")
|
return self.async_abort(reason="authorize_url_timeout")
|
||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
_LOGGER.exception("Unexpected error generating auth url")
|
_LOGGER.exception("Unexpected error generating auth url")
|
||||||
|
|
|
@ -136,7 +136,7 @@ class TtnDataStorage:
|
||||||
async with asyncio.timeout(DEFAULT_TIMEOUT):
|
async with asyncio.timeout(DEFAULT_TIMEOUT):
|
||||||
response = await session.get(self._url, headers=self._headers)
|
response = await session.get(self._url, headers=self._headers)
|
||||||
|
|
||||||
except (asyncio.TimeoutError, aiohttp.ClientError):
|
except (TimeoutError, aiohttp.ClientError):
|
||||||
_LOGGER.error("Error while accessing: %s", self._url)
|
_LOGGER.error("Error while accessing: %s", self._url)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""Support for Tibber."""
|
"""Support for Tibber."""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
@ -55,7 +54,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
await tibber_connection.update_info()
|
await tibber_connection.update_info()
|
||||||
|
|
||||||
except (
|
except (
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
aiohttp.ClientError,
|
aiohttp.ClientError,
|
||||||
tibber.RetryableHttpException,
|
tibber.RetryableHttpException,
|
||||||
) as err:
|
) as err:
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""Adds config flow for Tibber integration."""
|
"""Adds config flow for Tibber integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
@ -46,7 +45,7 @@ class TibberConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await tibber_connection.update_info()
|
await tibber_connection.update_info()
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
errors[CONF_ACCESS_TOKEN] = ERR_TIMEOUT
|
errors[CONF_ACCESS_TOKEN] = ERR_TIMEOUT
|
||||||
except tibber.InvalidLogin:
|
except tibber.InvalidLogin:
|
||||||
errors[CONF_ACCESS_TOKEN] = ERR_TOKEN
|
errors[CONF_ACCESS_TOKEN] = ERR_TOKEN
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""Support for Tibber notifications."""
|
"""Support for Tibber notifications."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@ -41,5 +40,5 @@ class TibberNotificationService(BaseNotificationService):
|
||||||
title = kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT)
|
title = kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT)
|
||||||
try:
|
try:
|
||||||
await self._notify(title=title, message=message)
|
await self._notify(title=title, message=message)
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
_LOGGER.error("Timeout sending message with Tibber")
|
_LOGGER.error("Timeout sending message with Tibber")
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""Support for Tibber sensors."""
|
"""Support for Tibber sensors."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
import datetime
|
import datetime
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
@ -255,7 +254,7 @@ async def async_setup_entry(
|
||||||
for home in tibber_connection.get_homes(only_active=False):
|
for home in tibber_connection.get_homes(only_active=False):
|
||||||
try:
|
try:
|
||||||
await home.update_info()
|
await home.update_info()
|
||||||
except asyncio.TimeoutError as err:
|
except TimeoutError as err:
|
||||||
_LOGGER.error("Timeout connecting to Tibber home: %s ", err)
|
_LOGGER.error("Timeout connecting to Tibber home: %s ", err)
|
||||||
raise PlatformNotReady() from err
|
raise PlatformNotReady() from err
|
||||||
except aiohttp.ClientError as err:
|
except aiohttp.ClientError as err:
|
||||||
|
@ -399,7 +398,7 @@ class TibberSensorElPrice(TibberSensor):
|
||||||
_LOGGER.debug("Fetching data")
|
_LOGGER.debug("Fetching data")
|
||||||
try:
|
try:
|
||||||
await self._tibber_home.update_info_and_price_info()
|
await self._tibber_home.update_info_and_price_info()
|
||||||
except (asyncio.TimeoutError, aiohttp.ClientError):
|
except (TimeoutError, aiohttp.ClientError):
|
||||||
return
|
return
|
||||||
data = self._tibber_home.info["viewer"]["home"]
|
data = self._tibber_home.info["viewer"]["home"]
|
||||||
self._attr_extra_state_attributes["app_nickname"] = data["appNickname"]
|
self._attr_extra_state_attributes["app_nickname"] = data["appNickname"]
|
||||||
|
|
|
@ -144,7 +144,7 @@ async def authenticate(
|
||||||
key = await api_factory.generate_psk(security_code)
|
key = await api_factory.generate_psk(security_code)
|
||||||
except RequestError as err:
|
except RequestError as err:
|
||||||
raise AuthError("invalid_security_code") from err
|
raise AuthError("invalid_security_code") from err
|
||||||
except asyncio.TimeoutError as err:
|
except TimeoutError as err:
|
||||||
raise AuthError("timeout") from err
|
raise AuthError("timeout") from err
|
||||||
finally:
|
finally:
|
||||||
await api_factory.shutdown()
|
await api_factory.shutdown()
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
"""The twinkly component."""
|
"""The twinkly component."""
|
||||||
|
|
||||||
import asyncio
|
|
||||||
|
|
||||||
from aiohttp import ClientError
|
from aiohttp import ClientError
|
||||||
from ttls.client import Twinkly
|
from ttls.client import Twinkly
|
||||||
|
@ -31,7 +30,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
try:
|
try:
|
||||||
device_info = await client.get_details()
|
device_info = await client.get_details()
|
||||||
software_version = await client.get_firmware_version()
|
software_version = await client.get_firmware_version()
|
||||||
except (asyncio.TimeoutError, ClientError) as exception:
|
except (TimeoutError, ClientError) as exception:
|
||||||
raise ConfigEntryNotReady from exception
|
raise ConfigEntryNotReady from exception
|
||||||
|
|
||||||
hass.data[DOMAIN][entry.entry_id] = {
|
hass.data[DOMAIN][entry.entry_id] = {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""Config flow to configure the Twinkly integration."""
|
"""Config flow to configure the Twinkly integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
@ -40,7 +39,7 @@ class TwinklyConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
device_info = await Twinkly(
|
device_info = await Twinkly(
|
||||||
host, async_get_clientsession(self.hass)
|
host, async_get_clientsession(self.hass)
|
||||||
).get_details()
|
).get_details()
|
||||||
except (asyncio.TimeoutError, ClientError):
|
except (TimeoutError, ClientError):
|
||||||
errors[CONF_HOST] = "cannot_connect"
|
errors[CONF_HOST] = "cannot_connect"
|
||||||
else:
|
else:
|
||||||
await self.async_set_unique_id(device_info[DEV_ID])
|
await self.async_set_unique_id(device_info[DEV_ID])
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""The Twinkly light component."""
|
"""The Twinkly light component."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
@ -282,7 +281,7 @@ class TwinklyLight(LightEntity):
|
||||||
# We don't use the echo API to track the availability since
|
# We don't use the echo API to track the availability since
|
||||||
# we already have to pull the device to get its state.
|
# we already have to pull the device to get its state.
|
||||||
self._attr_available = True
|
self._attr_available = True
|
||||||
except (asyncio.TimeoutError, ClientError):
|
except (TimeoutError, ClientError):
|
||||||
# We log this as "info" as it's pretty common that the Christmas
|
# We log this as "info" as it's pretty common that the Christmas
|
||||||
# light are not reachable in July
|
# light are not reachable in July
|
||||||
if self._attr_available:
|
if self._attr_available:
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""Config flow for Ukraine Alarm."""
|
"""Config flow for Ukraine Alarm."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
@ -50,7 +49,7 @@ class UkraineAlarmConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
except aiohttp.ClientError as ex:
|
except aiohttp.ClientError as ex:
|
||||||
reason = "unknown"
|
reason = "unknown"
|
||||||
unknown_err_msg = str(ex)
|
unknown_err_msg = str(ex)
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
reason = "timeout"
|
reason = "timeout"
|
||||||
|
|
||||||
if not reason and not regions:
|
if not reason and not regions:
|
||||||
|
|
|
@ -409,7 +409,7 @@ class UniFiController:
|
||||||
async_dispatcher_send(self.hass, self.signal_reachable)
|
async_dispatcher_send(self.hass, self.signal_reachable)
|
||||||
|
|
||||||
except (
|
except (
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
aiounifi.BadGateway,
|
aiounifi.BadGateway,
|
||||||
aiounifi.ServiceUnavailable,
|
aiounifi.ServiceUnavailable,
|
||||||
aiounifi.AiounifiException,
|
aiounifi.AiounifiException,
|
||||||
|
@ -516,7 +516,7 @@ async def get_unifi_controller(
|
||||||
raise AuthenticationRequired from err
|
raise AuthenticationRequired from err
|
||||||
|
|
||||||
except (
|
except (
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
aiounifi.BadGateway,
|
aiounifi.BadGateway,
|
||||||
aiounifi.Forbidden,
|
aiounifi.Forbidden,
|
||||||
aiounifi.ServiceUnavailable,
|
aiounifi.ServiceUnavailable,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""UniFi Protect Platform."""
|
"""UniFi Protect Platform."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
@ -64,7 +63,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
nvr_info = await protect.get_nvr()
|
nvr_info = await protect.get_nvr()
|
||||||
except NotAuthorized as err:
|
except NotAuthorized as err:
|
||||||
raise ConfigEntryAuthFailed(err) from err
|
raise ConfigEntryAuthFailed(err) from err
|
||||||
except (asyncio.TimeoutError, ClientError, ServerDisconnectedError) as err:
|
except (TimeoutError, ClientError, ServerDisconnectedError) as err:
|
||||||
raise ConfigEntryNotReady from err
|
raise ConfigEntryNotReady from err
|
||||||
|
|
||||||
if nvr_info.version < MIN_REQUIRED_PROTECT_V:
|
if nvr_info.version < MIN_REQUIRED_PROTECT_V:
|
||||||
|
|
|
@ -43,7 +43,7 @@ async def _validate_input(data):
|
||||||
|
|
||||||
upb.connect(_connected_callback)
|
upb.connect(_connected_callback)
|
||||||
|
|
||||||
with suppress(asyncio.TimeoutError):
|
with suppress(TimeoutError):
|
||||||
async with asyncio.timeout(VALIDATE_TIMEOUT):
|
async with asyncio.timeout(VALIDATE_TIMEOUT):
|
||||||
await connected_event.wait()
|
await connected_event.wait()
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
try:
|
try:
|
||||||
async with asyncio.timeout(10):
|
async with asyncio.timeout(10):
|
||||||
await device_discovered_event.wait()
|
await device_discovered_event.wait()
|
||||||
except asyncio.TimeoutError as err:
|
except TimeoutError as err:
|
||||||
raise ConfigEntryNotReady(f"Device not discovered: {usn}") from err
|
raise ConfigEntryNotReady(f"Device not discovered: {usn}") from err
|
||||||
finally:
|
finally:
|
||||||
cancel_discovered_callback()
|
cancel_discovered_callback()
|
||||||
|
|
|
@ -84,7 +84,7 @@ async def async_http_request(hass, uri):
|
||||||
return {"error": req.status}
|
return {"error": req.status}
|
||||||
json_response = await req.json()
|
json_response = await req.json()
|
||||||
return json_response
|
return json_response
|
||||||
except (asyncio.TimeoutError, aiohttp.ClientError) as exc:
|
except (TimeoutError, aiohttp.ClientError) as exc:
|
||||||
_LOGGER.error("Cannot connect to ViaggiaTreno API endpoint: %s", exc)
|
_LOGGER.error("Cannot connect to ViaggiaTreno API endpoint: %s", exc)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
_LOGGER.error("Received non-JSON data from ViaggiaTreno API endpoint")
|
_LOGGER.error("Received non-JSON data from ViaggiaTreno API endpoint")
|
||||||
|
|
|
@ -209,7 +209,7 @@ class VoiceRSSProvider(Provider):
|
||||||
_LOGGER.error("Error receive %s from VoiceRSS", str(data, "utf-8"))
|
_LOGGER.error("Error receive %s from VoiceRSS", str(data, "utf-8"))
|
||||||
return (None, None)
|
return (None, None)
|
||||||
|
|
||||||
except (asyncio.TimeoutError, aiohttp.ClientError):
|
except (TimeoutError, aiohttp.ClientError):
|
||||||
_LOGGER.error("Timeout for VoiceRSS API")
|
_LOGGER.error("Timeout for VoiceRSS API")
|
||||||
return (None, None)
|
return (None, None)
|
||||||
|
|
||||||
|
|
|
@ -259,7 +259,7 @@ class PipelineRtpDatagramProtocol(RtpDatagramProtocol):
|
||||||
|
|
||||||
if self.processing_tone_enabled:
|
if self.processing_tone_enabled:
|
||||||
await self._play_processing_tone()
|
await self._play_processing_tone()
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
# Expected after caller hangs up
|
# Expected after caller hangs up
|
||||||
_LOGGER.debug("Audio timeout")
|
_LOGGER.debug("Audio timeout")
|
||||||
self._session_id = None
|
self._session_id = None
|
||||||
|
@ -304,7 +304,7 @@ class PipelineRtpDatagramProtocol(RtpDatagramProtocol):
|
||||||
_LOGGER.debug("Pipeline finished")
|
_LOGGER.debug("Pipeline finished")
|
||||||
except PipelineNotFound:
|
except PipelineNotFound:
|
||||||
_LOGGER.warning("Pipeline not found")
|
_LOGGER.warning("Pipeline not found")
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
# Expected after caller hangs up
|
# Expected after caller hangs up
|
||||||
_LOGGER.debug("Pipeline timeout")
|
_LOGGER.debug("Pipeline timeout")
|
||||||
self._session_id = None
|
self._session_id = None
|
||||||
|
@ -444,7 +444,7 @@ class PipelineRtpDatagramProtocol(RtpDatagramProtocol):
|
||||||
async with asyncio.timeout(tts_seconds + self.tts_extra_timeout):
|
async with asyncio.timeout(tts_seconds + self.tts_extra_timeout):
|
||||||
# TTS audio is 16Khz 16-bit mono
|
# TTS audio is 16Khz 16-bit mono
|
||||||
await self._async_send_audio(audio_bytes)
|
await self._async_send_audio(audio_bytes)
|
||||||
except asyncio.TimeoutError as err:
|
except TimeoutError as err:
|
||||||
_LOGGER.warning("TTS timeout")
|
_LOGGER.warning("TTS timeout")
|
||||||
raise err
|
raise err
|
||||||
finally:
|
finally:
|
||||||
|
|
|
@ -153,7 +153,7 @@ async def websocket_entity_info(
|
||||||
try:
|
try:
|
||||||
async with asyncio.timeout(TIMEOUT_FETCH_WAKE_WORDS):
|
async with asyncio.timeout(TIMEOUT_FETCH_WAKE_WORDS):
|
||||||
wake_words = await entity.get_supported_wake_words()
|
wake_words = await entity.get_supported_wake_words()
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
connection.send_error(
|
connection.send_error(
|
||||||
msg["id"], websocket_api.const.ERR_TIMEOUT, "Timeout fetching wake words"
|
msg["id"], websocket_api.const.ERR_TIMEOUT, "Timeout fetching wake words"
|
||||||
)
|
)
|
||||||
|
|
|
@ -36,7 +36,7 @@ async def _async_can_discover_devices() -> bool:
|
||||||
try:
|
try:
|
||||||
client.on(EVENT_DEVICE_DISCOVERED, _async_found)
|
client.on(EVENT_DEVICE_DISCOVERED, _async_found)
|
||||||
await future_event
|
await future_event
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -32,6 +32,6 @@ WEBOSTV_EXCEPTIONS = (
|
||||||
ConnectionClosedOK,
|
ConnectionClosedOK,
|
||||||
ConnectionRefusedError,
|
ConnectionRefusedError,
|
||||||
WebOsTvCommandError,
|
WebOsTvCommandError,
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
asyncio.CancelledError,
|
asyncio.CancelledError,
|
||||||
)
|
)
|
||||||
|
|
|
@ -474,7 +474,7 @@ class LgWebOSMediaPlayerEntity(RestoreEntity, MediaPlayerEntity):
|
||||||
content = None
|
content = None
|
||||||
|
|
||||||
websession = async_get_clientsession(self.hass)
|
websession = async_get_clientsession(self.hass)
|
||||||
with suppress(asyncio.TimeoutError):
|
with suppress(TimeoutError):
|
||||||
async with asyncio.timeout(10):
|
async with asyncio.timeout(10):
|
||||||
response = await websession.get(url, ssl=False)
|
response = await websession.get(url, ssl=False)
|
||||||
if response.status == HTTPStatus.OK:
|
if response.status == HTTPStatus.OK:
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""Connection session."""
|
"""Connection session."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
from collections.abc import Callable, Hashable
|
from collections.abc import Callable, Hashable
|
||||||
from contextvars import ContextVar
|
from contextvars import ContextVar
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
@ -266,7 +265,7 @@ class ActiveConnection:
|
||||||
elif isinstance(err, vol.Invalid):
|
elif isinstance(err, vol.Invalid):
|
||||||
code = const.ERR_INVALID_FORMAT
|
code = const.ERR_INVALID_FORMAT
|
||||||
err_message = vol.humanize.humanize_error(msg, err)
|
err_message = vol.humanize.humanize_error(msg, err)
|
||||||
elif isinstance(err, asyncio.TimeoutError):
|
elif isinstance(err, TimeoutError):
|
||||||
code = const.ERR_TIMEOUT
|
code = const.ERR_TIMEOUT
|
||||||
err_message = "Timeout"
|
err_message = "Timeout"
|
||||||
elif isinstance(err, HomeAssistantError):
|
elif isinstance(err, HomeAssistantError):
|
||||||
|
|
|
@ -282,7 +282,7 @@ class WebSocketHandler:
|
||||||
try:
|
try:
|
||||||
async with asyncio.timeout(10):
|
async with asyncio.timeout(10):
|
||||||
await wsock.prepare(request)
|
await wsock.prepare(request)
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
self._logger.warning("Timeout preparing request from %s", request.remote)
|
self._logger.warning("Timeout preparing request from %s", request.remote)
|
||||||
return wsock
|
return wsock
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ class WebSocketHandler:
|
||||||
# Auth Phase
|
# Auth Phase
|
||||||
try:
|
try:
|
||||||
msg = await wsock.receive(10)
|
msg = await wsock.receive(10)
|
||||||
except asyncio.TimeoutError as err:
|
except TimeoutError as err:
|
||||||
disconnect_warn = "Did not receive auth message within 10 seconds"
|
disconnect_warn = "Did not receive auth message within 10 seconds"
|
||||||
raise Disconnect from err
|
raise Disconnect from err
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""The Whirlpool Appliances integration."""
|
"""The Whirlpool Appliances integration."""
|
||||||
import asyncio
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
@ -35,7 +34,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
await auth.do_auth(store=False)
|
await auth.do_auth(store=False)
|
||||||
except (ClientError, asyncio.TimeoutError) as ex:
|
except (ClientError, TimeoutError) as ex:
|
||||||
raise ConfigEntryNotReady("Cannot connect") from ex
|
raise ConfigEntryNotReady("Cannot connect") from ex
|
||||||
|
|
||||||
if not auth.is_access_token_valid():
|
if not auth.is_access_token_valid():
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""Config flow for Whirlpool Appliances integration."""
|
"""Config flow for Whirlpool Appliances integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@ -48,7 +47,7 @@ async def validate_input(
|
||||||
auth = Auth(backend_selector, data[CONF_USERNAME], data[CONF_PASSWORD], session)
|
auth = Auth(backend_selector, data[CONF_USERNAME], data[CONF_PASSWORD], session)
|
||||||
try:
|
try:
|
||||||
await auth.do_auth()
|
await auth.do_auth()
|
||||||
except (asyncio.TimeoutError, ClientError) as exc:
|
except (TimeoutError, ClientError) as exc:
|
||||||
raise CannotConnect from exc
|
raise CannotConnect from exc
|
||||||
|
|
||||||
if not auth.is_access_token_valid():
|
if not auth.is_access_token_valid():
|
||||||
|
@ -92,7 +91,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
await validate_input(self.hass, data)
|
await validate_input(self.hass, data)
|
||||||
except InvalidAuth:
|
except InvalidAuth:
|
||||||
errors["base"] = "invalid_auth"
|
errors["base"] = "invalid_auth"
|
||||||
except (CannotConnect, asyncio.TimeoutError):
|
except (CannotConnect, TimeoutError):
|
||||||
errors["base"] = "cannot_connect"
|
errors["base"] = "cannot_connect"
|
||||||
else:
|
else:
|
||||||
self.hass.config_entries.async_update_entry(
|
self.hass.config_entries.async_update_entry(
|
||||||
|
|
|
@ -97,7 +97,7 @@ class WorxLandroidSensor(SensorEntity):
|
||||||
async with asyncio.timeout(self.timeout):
|
async with asyncio.timeout(self.timeout):
|
||||||
auth = aiohttp.helpers.BasicAuth("admin", self.pin)
|
auth = aiohttp.helpers.BasicAuth("admin", self.pin)
|
||||||
mower_response = await session.get(self.url, auth=auth)
|
mower_response = await session.get(self.url, auth=auth)
|
||||||
except (asyncio.TimeoutError, aiohttp.ClientError):
|
except (TimeoutError, aiohttp.ClientError):
|
||||||
if self.allow_unreachable is False:
|
if self.allow_unreachable is False:
|
||||||
_LOGGER.error("Error connecting to mower at %s", self.url)
|
_LOGGER.error("Error connecting to mower at %s", self.url)
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ async def load_wyoming_info(
|
||||||
|
|
||||||
if wyoming_info is not None:
|
if wyoming_info is not None:
|
||||||
break # for
|
break # for
|
||||||
except (asyncio.TimeoutError, OSError, WyomingError):
|
except (TimeoutError, OSError, WyomingError):
|
||||||
# Sleep and try again
|
# Sleep and try again
|
||||||
await asyncio.sleep(retry_wait)
|
await asyncio.sleep(retry_wait)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""Config flow for Xiaomi Bluetooth integration."""
|
"""Config flow for Xiaomi Bluetooth integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
import dataclasses
|
import dataclasses
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@ -96,7 +95,7 @@ class XiaomiConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
self._discovery_info = await self._async_wait_for_full_advertisement(
|
self._discovery_info = await self._async_wait_for_full_advertisement(
|
||||||
discovery_info, device
|
discovery_info, device
|
||||||
)
|
)
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
# This device might have a really long advertising interval
|
# This device might have a really long advertising interval
|
||||||
# So create a config entry for it, and if we discover it has
|
# So create a config entry for it, and if we discover it has
|
||||||
# encryption later, we can do a reauth
|
# encryption later, we can do a reauth
|
||||||
|
@ -220,7 +219,7 @@ class XiaomiConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
self._discovery_info = await self._async_wait_for_full_advertisement(
|
self._discovery_info = await self._async_wait_for_full_advertisement(
|
||||||
discovery.discovery_info, discovery.device
|
discovery.discovery_info, discovery.device
|
||||||
)
|
)
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
# This device might have a really long advertising interval
|
# This device might have a really long advertising interval
|
||||||
# So create a config entry for it, and if we discover
|
# So create a config entry for it, and if we discover
|
||||||
# it has encryption later, we can do a reauth
|
# it has encryption later, we can do a reauth
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
"""The Yale Access Bluetooth integration."""
|
"""The Yale Access Bluetooth integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
|
|
||||||
from yalexs_ble import (
|
from yalexs_ble import (
|
||||||
AuthError,
|
AuthError,
|
||||||
ConnectionInfo,
|
ConnectionInfo,
|
||||||
|
@ -89,7 +87,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
await push_lock.wait_for_first_update(DEVICE_TIMEOUT)
|
await push_lock.wait_for_first_update(DEVICE_TIMEOUT)
|
||||||
except AuthError as ex:
|
except AuthError as ex:
|
||||||
raise ConfigEntryAuthFailed(str(ex)) from ex
|
raise ConfigEntryAuthFailed(str(ex)) from ex
|
||||||
except (YaleXSBLEError, asyncio.TimeoutError) as ex:
|
except (YaleXSBLEError, TimeoutError) as ex:
|
||||||
raise ConfigEntryNotReady(
|
raise ConfigEntryNotReady(
|
||||||
f"{ex}; Try moving the Bluetooth adapter closer to {local_name}"
|
f"{ex}; Try moving the Bluetooth adapter closer to {local_name}"
|
||||||
) from ex
|
) from ex
|
||||||
|
|
|
@ -139,7 +139,7 @@ class YandexSpeechKitProvider(Provider):
|
||||||
return (None, None)
|
return (None, None)
|
||||||
data = await request.read()
|
data = await request.read()
|
||||||
|
|
||||||
except (asyncio.TimeoutError, aiohttp.ClientError):
|
except (TimeoutError, aiohttp.ClientError):
|
||||||
_LOGGER.error("Timeout for yandex speech kit API")
|
_LOGGER.error("Timeout for yandex speech kit API")
|
||||||
return (None, None)
|
return (None, None)
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ class YardianUpdateCoordinator(DataUpdateCoordinator[YardianDeviceState]):
|
||||||
async with asyncio.timeout(10):
|
async with asyncio.timeout(10):
|
||||||
return await self.controller.fetch_device_state()
|
return await self.controller.fetch_device_state()
|
||||||
|
|
||||||
except asyncio.TimeoutError as e:
|
except TimeoutError as e:
|
||||||
raise UpdateFailed("Communication with Device was time out") from e
|
raise UpdateFailed("Communication with Device was time out") from e
|
||||||
except NotAuthorizedException as e:
|
except NotAuthorizedException as e:
|
||||||
raise UpdateFailed("Invalid access token") from e
|
raise UpdateFailed("Invalid access token") from e
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""Support for Xiaomi Yeelight WiFi color bulb."""
|
"""Support for Xiaomi Yeelight WiFi color bulb."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
@ -214,7 +213,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
try:
|
try:
|
||||||
device = await _async_get_device(hass, entry.data[CONF_HOST], entry)
|
device = await _async_get_device(hass, entry.data[CONF_HOST], entry)
|
||||||
await _async_initialize(hass, entry, device)
|
await _async_initialize(hass, entry, device)
|
||||||
except (asyncio.TimeoutError, OSError, BulbException) as ex:
|
except (TimeoutError, OSError, BulbException) as ex:
|
||||||
raise ConfigEntryNotReady from ex
|
raise ConfigEntryNotReady from ex
|
||||||
|
|
||||||
found_unique_id = device.unique_id
|
found_unique_id = device.unique_id
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""Config flow for Yeelight integration."""
|
"""Config flow for Yeelight integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
@ -268,7 +267,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
await bulb.async_listen(lambda _: True)
|
await bulb.async_listen(lambda _: True)
|
||||||
await bulb.async_get_properties()
|
await bulb.async_get_properties()
|
||||||
await bulb.async_stop_listening()
|
await bulb.async_stop_listening()
|
||||||
except (asyncio.TimeoutError, yeelight.BulbException) as err:
|
except (TimeoutError, yeelight.BulbException) as err:
|
||||||
_LOGGER.debug("Failed to get properties from %s: %s", host, err)
|
_LOGGER.debug("Failed to get properties from %s: %s", host, err)
|
||||||
raise CannotConnect from err
|
raise CannotConnect from err
|
||||||
_LOGGER.debug("Get properties: %s", bulb.last_properties)
|
_LOGGER.debug("Get properties: %s", bulb.last_properties)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""Support for Xiaomi Yeelight WiFi color bulb."""
|
"""Support for Xiaomi Yeelight WiFi color bulb."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
@ -176,7 +175,7 @@ class YeelightDevice:
|
||||||
self._available = True
|
self._available = True
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
self._initialized = True
|
self._initialized = True
|
||||||
except asyncio.TimeoutError as ex:
|
except TimeoutError as ex:
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"timed out while trying to update device %s, %s: %s",
|
"timed out while trying to update device %s, %s: %s",
|
||||||
self._host,
|
self._host,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""Light platform support for yeelight."""
|
"""Light platform support for yeelight."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
from collections.abc import Callable, Coroutine
|
from collections.abc import Callable, Coroutine
|
||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
|
@ -255,7 +254,7 @@ def _async_cmd(
|
||||||
try:
|
try:
|
||||||
_LOGGER.debug("Calling %s with %s %s", func, args, kwargs)
|
_LOGGER.debug("Calling %s with %s %s", func, args, kwargs)
|
||||||
return await func(self, *args, **kwargs)
|
return await func(self, *args, **kwargs)
|
||||||
except asyncio.TimeoutError as ex:
|
except TimeoutError as ex:
|
||||||
# The wifi likely dropped, so we want to retry once since
|
# The wifi likely dropped, so we want to retry once since
|
||||||
# python-yeelight will auto reconnect
|
# python-yeelight will auto reconnect
|
||||||
if attempts == 0:
|
if attempts == 0:
|
||||||
|
|
|
@ -155,7 +155,7 @@ class YeelightScanner:
|
||||||
for listener in self._listeners:
|
for listener in self._listeners:
|
||||||
listener.async_search((host, SSDP_TARGET[1]))
|
listener.async_search((host, SSDP_TARGET[1]))
|
||||||
|
|
||||||
with contextlib.suppress(asyncio.TimeoutError):
|
with contextlib.suppress(TimeoutError):
|
||||||
async with asyncio.timeout(DISCOVERY_TIMEOUT):
|
async with asyncio.timeout(DISCOVERY_TIMEOUT):
|
||||||
await host_event.wait()
|
await host_event.wait()
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
)
|
)
|
||||||
except YoLinkAuthFailError as yl_auth_err:
|
except YoLinkAuthFailError as yl_auth_err:
|
||||||
raise ConfigEntryAuthFailed from yl_auth_err
|
raise ConfigEntryAuthFailed from yl_auth_err
|
||||||
except (YoLinkClientError, asyncio.TimeoutError) as err:
|
except (YoLinkClientError, TimeoutError) as err:
|
||||||
raise ConfigEntryNotReady from err
|
raise ConfigEntryNotReady from err
|
||||||
|
|
||||||
device_coordinators = {}
|
device_coordinators = {}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""Cluster handlers module for Zigbee Home Automation."""
|
"""Cluster handlers module for Zigbee Home Automation."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
from collections.abc import Awaitable, Callable, Coroutine, Iterator
|
from collections.abc import Awaitable, Callable, Coroutine, Iterator
|
||||||
import contextlib
|
import contextlib
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
@ -62,7 +61,7 @@ def wrap_zigpy_exceptions() -> Iterator[None]:
|
||||||
"""Wrap zigpy exceptions in `HomeAssistantError` exceptions."""
|
"""Wrap zigpy exceptions in `HomeAssistantError` exceptions."""
|
||||||
try:
|
try:
|
||||||
yield
|
yield
|
||||||
except asyncio.TimeoutError as exc:
|
except TimeoutError as exc:
|
||||||
raise HomeAssistantError(
|
raise HomeAssistantError(
|
||||||
"Failed to send request: device did not respond"
|
"Failed to send request: device did not respond"
|
||||||
) from exc
|
) from exc
|
||||||
|
@ -214,7 +213,7 @@ class ClusterHandler(LogMixin):
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
except (zigpy.exceptions.ZigbeeException, asyncio.TimeoutError) as ex:
|
except (zigpy.exceptions.ZigbeeException, TimeoutError) as ex:
|
||||||
self.debug(
|
self.debug(
|
||||||
"Failed to bind '%s' cluster: %s",
|
"Failed to bind '%s' cluster: %s",
|
||||||
self.cluster.ep_attribute,
|
self.cluster.ep_attribute,
|
||||||
|
@ -275,7 +274,7 @@ class ClusterHandler(LogMixin):
|
||||||
try:
|
try:
|
||||||
res = await self.cluster.configure_reporting_multiple(reports, **kwargs)
|
res = await self.cluster.configure_reporting_multiple(reports, **kwargs)
|
||||||
self._configure_reporting_status(reports, res[0], event_data)
|
self._configure_reporting_status(reports, res[0], event_data)
|
||||||
except (zigpy.exceptions.ZigbeeException, asyncio.TimeoutError) as ex:
|
except (zigpy.exceptions.ZigbeeException, TimeoutError) as ex:
|
||||||
self.debug(
|
self.debug(
|
||||||
"failed to set reporting on '%s' cluster for: %s",
|
"failed to set reporting on '%s' cluster for: %s",
|
||||||
self.cluster.ep_attribute,
|
self.cluster.ep_attribute,
|
||||||
|
@ -518,7 +517,7 @@ class ClusterHandler(LogMixin):
|
||||||
manufacturer=manufacturer,
|
manufacturer=manufacturer,
|
||||||
)
|
)
|
||||||
result.update(read)
|
result.update(read)
|
||||||
except (asyncio.TimeoutError, zigpy.exceptions.ZigbeeException) as ex:
|
except (TimeoutError, zigpy.exceptions.ZigbeeException) as ex:
|
||||||
self.debug(
|
self.debug(
|
||||||
"failed to get attributes '%s' on '%s' cluster: %s",
|
"failed to get attributes '%s' on '%s' cluster: %s",
|
||||||
chunk,
|
chunk,
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""Lightlink cluster handlers module for Zigbee Home Automation."""
|
"""Lightlink cluster handlers module for Zigbee Home Automation."""
|
||||||
import asyncio
|
|
||||||
|
|
||||||
import zigpy.exceptions
|
import zigpy.exceptions
|
||||||
from zigpy.zcl.clusters.lightlink import LightLink
|
from zigpy.zcl.clusters.lightlink import LightLink
|
||||||
|
@ -32,7 +31,7 @@ class LightLinkClusterHandler(ClusterHandler):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
rsp = await self.cluster.get_group_identifiers(0)
|
rsp = await self.cluster.get_group_identifiers(0)
|
||||||
except (zigpy.exceptions.ZigbeeException, asyncio.TimeoutError) as exc:
|
except (zigpy.exceptions.ZigbeeException, TimeoutError) as exc:
|
||||||
self.warning("Couldn't get list of groups: %s", str(exc))
|
self.warning("Couldn't get list of groups: %s", str(exc))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -870,7 +870,7 @@ class ZHADevice(LogMixin):
|
||||||
# store it, so we cannot rely on it existing after being written. This is
|
# store it, so we cannot rely on it existing after being written. This is
|
||||||
# only done to make the ZCL command valid.
|
# only done to make the ZCL command valid.
|
||||||
await self._zigpy_device.add_to_group(group_id, name=f"0x{group_id:04X}")
|
await self._zigpy_device.add_to_group(group_id, name=f"0x{group_id:04X}")
|
||||||
except (zigpy.exceptions.ZigbeeException, asyncio.TimeoutError) as ex:
|
except (zigpy.exceptions.ZigbeeException, TimeoutError) as ex:
|
||||||
self.debug(
|
self.debug(
|
||||||
"Failed to add device '%s' to group: 0x%04x ex: %s",
|
"Failed to add device '%s' to group: 0x%04x ex: %s",
|
||||||
self._zigpy_device.ieee,
|
self._zigpy_device.ieee,
|
||||||
|
@ -882,7 +882,7 @@ class ZHADevice(LogMixin):
|
||||||
"""Remove this device from the provided zigbee group."""
|
"""Remove this device from the provided zigbee group."""
|
||||||
try:
|
try:
|
||||||
await self._zigpy_device.remove_from_group(group_id)
|
await self._zigpy_device.remove_from_group(group_id)
|
||||||
except (zigpy.exceptions.ZigbeeException, asyncio.TimeoutError) as ex:
|
except (zigpy.exceptions.ZigbeeException, TimeoutError) as ex:
|
||||||
self.debug(
|
self.debug(
|
||||||
"Failed to remove device '%s' from group: 0x%04x ex: %s",
|
"Failed to remove device '%s' from group: 0x%04x ex: %s",
|
||||||
self._zigpy_device.ieee,
|
self._zigpy_device.ieee,
|
||||||
|
@ -898,7 +898,7 @@ class ZHADevice(LogMixin):
|
||||||
await self._zigpy_device.endpoints[endpoint_id].add_to_group(
|
await self._zigpy_device.endpoints[endpoint_id].add_to_group(
|
||||||
group_id, name=f"0x{group_id:04X}"
|
group_id, name=f"0x{group_id:04X}"
|
||||||
)
|
)
|
||||||
except (zigpy.exceptions.ZigbeeException, asyncio.TimeoutError) as ex:
|
except (zigpy.exceptions.ZigbeeException, TimeoutError) as ex:
|
||||||
self.debug(
|
self.debug(
|
||||||
"Failed to add endpoint: %s for device: '%s' to group: 0x%04x ex: %s",
|
"Failed to add endpoint: %s for device: '%s' to group: 0x%04x ex: %s",
|
||||||
endpoint_id,
|
endpoint_id,
|
||||||
|
@ -913,7 +913,7 @@ class ZHADevice(LogMixin):
|
||||||
"""Remove the device endpoint from the provided zigbee group."""
|
"""Remove the device endpoint from the provided zigbee group."""
|
||||||
try:
|
try:
|
||||||
await self._zigpy_device.endpoints[endpoint_id].remove_from_group(group_id)
|
await self._zigpy_device.endpoints[endpoint_id].remove_from_group(group_id)
|
||||||
except (zigpy.exceptions.ZigbeeException, asyncio.TimeoutError) as ex:
|
except (zigpy.exceptions.ZigbeeException, TimeoutError) as ex:
|
||||||
self.debug(
|
self.debug(
|
||||||
(
|
(
|
||||||
"Failed to remove endpoint: %s for device '%s' from group: 0x%04x"
|
"Failed to remove endpoint: %s for device '%s' from group: 0x%04x"
|
||||||
|
|
|
@ -112,7 +112,7 @@ class ZHAGroupMember(LogMixin):
|
||||||
await self._zha_device.device.endpoints[
|
await self._zha_device.device.endpoints[
|
||||||
self._endpoint_id
|
self._endpoint_id
|
||||||
].remove_from_group(self._zha_group.group_id)
|
].remove_from_group(self._zha_group.group_id)
|
||||||
except (zigpy.exceptions.ZigbeeException, asyncio.TimeoutError) as ex:
|
except (zigpy.exceptions.ZigbeeException, TimeoutError) as ex:
|
||||||
self.debug(
|
self.debug(
|
||||||
(
|
(
|
||||||
"Failed to remove endpoint: %s for device '%s' from group: 0x%04x"
|
"Failed to remove endpoint: %s for device '%s' from group: 0x%04x"
|
||||||
|
|
|
@ -168,7 +168,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
translation_key="invalid_server_version",
|
translation_key="invalid_server_version",
|
||||||
)
|
)
|
||||||
raise ConfigEntryNotReady(f"Invalid server version: {err}") from err
|
raise ConfigEntryNotReady(f"Invalid server version: {err}") from err
|
||||||
except (asyncio.TimeoutError, BaseZwaveJSServerError) as err:
|
except (TimeoutError, BaseZwaveJSServerError) as err:
|
||||||
raise ConfigEntryNotReady(f"Failed to connect: {err}") from err
|
raise ConfigEntryNotReady(f"Failed to connect: {err}") from err
|
||||||
|
|
||||||
async_delete_issue(hass, DOMAIN, "invalid_server_version")
|
async_delete_issue(hass, DOMAIN, "invalid_server_version")
|
||||||
|
|
|
@ -118,7 +118,7 @@ async def async_get_version_info(hass: HomeAssistant, ws_address: str) -> Versio
|
||||||
version_info: VersionInfo = await get_server_version(
|
version_info: VersionInfo = await get_server_version(
|
||||||
ws_address, async_get_clientsession(hass)
|
ws_address, async_get_clientsession(hass)
|
||||||
)
|
)
|
||||||
except (asyncio.TimeoutError, aiohttp.ClientError) as err:
|
except (TimeoutError, aiohttp.ClientError) as err:
|
||||||
# We don't want to spam the log if the add-on isn't started
|
# We don't want to spam the log if the add-on isn't started
|
||||||
# or takes a long time to start.
|
# or takes a long time to start.
|
||||||
_LOGGER.debug("Failed to connect to Z-Wave JS server: %s", err)
|
_LOGGER.debug("Failed to connect to Z-Wave JS server: %s", err)
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# flake8: noqa pylint: skip-file
|
# flake8: noqa pylint: skip-file
|
||||||
"""Tests for the TelldusLive config flow."""
|
"""Tests for the TelldusLive config flow."""
|
||||||
import asyncio
|
|
||||||
from unittest.mock import Mock, patch
|
from unittest.mock import Mock, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -224,7 +223,7 @@ async def test_abort_if_timeout_generating_auth_url(
|
||||||
hass: HomeAssistant, mock_tellduslive
|
hass: HomeAssistant, mock_tellduslive
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test abort if generating authorize url timeout."""
|
"""Test abort if generating authorize url timeout."""
|
||||||
flow = init_config_flow(hass, side_effect=asyncio.TimeoutError)
|
flow = init_config_flow(hass, side_effect=TimeoutError)
|
||||||
|
|
||||||
result = await flow.async_step_user()
|
result = await flow.async_step_user()
|
||||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""Test the Ukraine Alarm config flow."""
|
"""Test the Ukraine Alarm config flow."""
|
||||||
import asyncio
|
|
||||||
from collections.abc import Generator
|
from collections.abc import Generator
|
||||||
from unittest.mock import AsyncMock, patch
|
from unittest.mock import AsyncMock, patch
|
||||||
|
|
||||||
|
@ -271,7 +270,7 @@ async def test_unknown_client_error(
|
||||||
|
|
||||||
async def test_timeout_error(hass: HomeAssistant, mock_get_regions: AsyncMock) -> None:
|
async def test_timeout_error(hass: HomeAssistant, mock_get_regions: AsyncMock) -> None:
|
||||||
"""Test timeout error."""
|
"""Test timeout error."""
|
||||||
mock_get_regions.side_effect = asyncio.TimeoutError
|
mock_get_regions.side_effect = TimeoutError
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""Test UniFi Network."""
|
"""Test UniFi Network."""
|
||||||
import asyncio
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
@ -421,7 +420,7 @@ async def test_reconnect_mechanism(
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"exception",
|
"exception",
|
||||||
[
|
[
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
aiounifi.BadGateway,
|
aiounifi.BadGateway,
|
||||||
aiounifi.ServiceUnavailable,
|
aiounifi.ServiceUnavailable,
|
||||||
aiounifi.AiounifiException,
|
aiounifi.AiounifiException,
|
||||||
|
@ -459,7 +458,7 @@ async def test_get_unifi_controller_verify_ssl_false(hass: HomeAssistant) -> Non
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("side_effect", "raised_exception"),
|
("side_effect", "raised_exception"),
|
||||||
[
|
[
|
||||||
(asyncio.TimeoutError, CannotConnect),
|
(TimeoutError, CannotConnect),
|
||||||
(aiounifi.BadGateway, CannotConnect),
|
(aiounifi.BadGateway, CannotConnect),
|
||||||
(aiounifi.Forbidden, CannotConnect),
|
(aiounifi.Forbidden, CannotConnect),
|
||||||
(aiounifi.ServiceUnavailable, CannotConnect),
|
(aiounifi.ServiceUnavailable, CannotConnect),
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""The tests for the VoiceRSS speech platform."""
|
"""The tests for the VoiceRSS speech platform."""
|
||||||
import asyncio
|
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -213,7 +212,7 @@ async def test_service_say_timeout(
|
||||||
"""Test service call say with http timeout."""
|
"""Test service call say with http timeout."""
|
||||||
calls = async_mock_service(hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
|
calls = async_mock_service(hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
|
||||||
|
|
||||||
aioclient_mock.post(URL, data=FORM_DATA, exc=asyncio.TimeoutError())
|
aioclient_mock.post(URL, data=FORM_DATA, exc=TimeoutError())
|
||||||
|
|
||||||
config = {tts.DOMAIN: {"platform": "voicerss", "api_key": "1234567xx"}}
|
config = {tts.DOMAIN: {"platform": "voicerss", "api_key": "1234567xx"}}
|
||||||
|
|
||||||
|
|
|
@ -319,7 +319,7 @@ async def test_tts_timeout(
|
||||||
|
|
||||||
async def send_tts(*args, **kwargs):
|
async def send_tts(*args, **kwargs):
|
||||||
# Call original then end test successfully
|
# Call original then end test successfully
|
||||||
with pytest.raises(asyncio.TimeoutError):
|
with pytest.raises(TimeoutError):
|
||||||
await original_send_tts(*args, **kwargs)
|
await original_send_tts(*args, **kwargs)
|
||||||
|
|
||||||
done.set()
|
done.set()
|
||||||
|
|
|
@ -55,7 +55,7 @@ async def test_devices_with_mocks(
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("exception", "error_msg"),
|
("exception", "error_msg"),
|
||||||
[
|
[
|
||||||
(asyncio.TimeoutError, ERROR_MSG_NO_DEVICE_FOUND),
|
(TimeoutError, ERROR_MSG_NO_DEVICE_FOUND),
|
||||||
(asyncio.exceptions.CancelledError, ERROR_MSG_CANNOT_CONNECT),
|
(asyncio.exceptions.CancelledError, ERROR_MSG_CANNOT_CONNECT),
|
||||||
(AddressInUseError, ERROR_MSG_ADDRESS_IN_USE),
|
(AddressInUseError, ERROR_MSG_ADDRESS_IN_USE),
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""The tests for the LG webOS media player platform."""
|
"""The tests for the LG webOS media player platform."""
|
||||||
import asyncio
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from unittest.mock import Mock
|
from unittest.mock import Mock
|
||||||
|
@ -469,7 +468,7 @@ async def test_client_disconnected(hass: HomeAssistant, client, monkeypatch) ->
|
||||||
"""Test error not raised when client is disconnected."""
|
"""Test error not raised when client is disconnected."""
|
||||||
await setup_webostv(hass)
|
await setup_webostv(hass)
|
||||||
monkeypatch.setattr(client, "is_connected", Mock(return_value=False))
|
monkeypatch.setattr(client, "is_connected", Mock(return_value=False))
|
||||||
monkeypatch.setattr(client, "connect", Mock(side_effect=asyncio.TimeoutError))
|
monkeypatch.setattr(client, "connect", Mock(side_effect=TimeoutError))
|
||||||
|
|
||||||
async_fire_time_changed(hass, dt_util.utcnow() + timedelta(seconds=20))
|
async_fire_time_changed(hass, dt_util.utcnow() + timedelta(seconds=20))
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
@ -495,7 +494,7 @@ async def test_control_error_handling(
|
||||||
|
|
||||||
# Device off, log a warning
|
# Device off, log a warning
|
||||||
monkeypatch.setattr(client, "is_on", False)
|
monkeypatch.setattr(client, "is_on", False)
|
||||||
monkeypatch.setattr(client, "play", Mock(side_effect=asyncio.TimeoutError))
|
monkeypatch.setattr(client, "play", Mock(side_effect=TimeoutError))
|
||||||
await client.mock_state_update()
|
await client.mock_state_update()
|
||||||
await hass.services.async_call(MP_DOMAIN, SERVICE_MEDIA_PLAY, data, True)
|
await hass.services.async_call(MP_DOMAIN, SERVICE_MEDIA_PLAY, data, True)
|
||||||
|
|
||||||
|
@ -752,7 +751,7 @@ async def test_get_image_http_error(
|
||||||
attrs = hass.states.get(ENTITY_ID).attributes
|
attrs = hass.states.get(ENTITY_ID).attributes
|
||||||
assert "entity_picture_local" not in attrs
|
assert "entity_picture_local" not in attrs
|
||||||
|
|
||||||
aioclient_mock.get(url, exc=asyncio.TimeoutError())
|
aioclient_mock.get(url, exc=TimeoutError())
|
||||||
client = await hass_client_no_auth()
|
client = await hass_client_no_auth()
|
||||||
|
|
||||||
resp = await client.get(attrs["entity_picture"])
|
resp = await client.get(attrs["entity_picture"])
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""Test WebSocket Connection class."""
|
"""Test WebSocket Connection class."""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from unittest.mock import AsyncMock, Mock, patch
|
from unittest.mock import AsyncMock, Mock, patch
|
||||||
|
@ -32,7 +31,7 @@ from tests.common import MockUser
|
||||||
"Error handling message: Invalid something. Got {'id': 5} (invalid_format) Mock User from 127.0.0.42 (Browser)",
|
"Error handling message: Invalid something. Got {'id': 5} (invalid_format) Mock User from 127.0.0.42 (Browser)",
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
asyncio.TimeoutError(),
|
TimeoutError(),
|
||||||
websocket_api.ERR_TIMEOUT,
|
websocket_api.ERR_TIMEOUT,
|
||||||
"Timeout",
|
"Timeout",
|
||||||
"Error handling message: Timeout (timeout) Mock User from 127.0.0.42 (Browser)",
|
"Error handling message: Timeout (timeout) Mock User from 127.0.0.42 (Browser)",
|
||||||
|
|
|
@ -372,7 +372,7 @@ async def test_prepare_fail(
|
||||||
"""Test failing to prepare."""
|
"""Test failing to prepare."""
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.websocket_api.http.web.WebSocketResponse.prepare",
|
"homeassistant.components.websocket_api.http.web.WebSocketResponse.prepare",
|
||||||
side_effect=(asyncio.TimeoutError, web.WebSocketResponse.prepare),
|
side_effect=(TimeoutError, web.WebSocketResponse.prepare),
|
||||||
), pytest.raises(ServerDisconnectedError):
|
), pytest.raises(ServerDisconnectedError):
|
||||||
await hass_ws_client(hass)
|
await hass_ws_client(hass)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""Test the Whirlpool Sixth Sense config flow."""
|
"""Test the Whirlpool Sixth Sense config flow."""
|
||||||
import asyncio
|
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
@ -110,7 +109,7 @@ async def test_form_auth_timeout(hass: HomeAssistant, region) -> None:
|
||||||
)
|
)
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.whirlpool.config_flow.Auth.do_auth",
|
"homeassistant.components.whirlpool.config_flow.Auth.do_auth",
|
||||||
side_effect=asyncio.TimeoutError,
|
side_effect=TimeoutError,
|
||||||
):
|
):
|
||||||
result2 = await hass.config_entries.flow.async_configure(
|
result2 = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"],
|
result["flow_id"],
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""Test the Xiaomi config flow."""
|
"""Test the Xiaomi config flow."""
|
||||||
import asyncio
|
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from xiaomi_ble import XiaomiBluetoothDeviceData as DeviceData
|
from xiaomi_ble import XiaomiBluetoothDeviceData as DeviceData
|
||||||
|
@ -50,7 +49,7 @@ async def test_async_step_bluetooth_valid_device_but_missing_payload(
|
||||||
"""Test discovery via bluetooth with a valid device but missing payload."""
|
"""Test discovery via bluetooth with a valid device but missing payload."""
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.xiaomi_ble.config_flow.async_process_advertisements",
|
"homeassistant.components.xiaomi_ble.config_flow.async_process_advertisements",
|
||||||
side_effect=asyncio.TimeoutError(),
|
side_effect=TimeoutError(),
|
||||||
):
|
):
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
|
@ -402,7 +401,7 @@ async def test_async_step_user_short_payload(hass: HomeAssistant) -> None:
|
||||||
assert result["step_id"] == "user"
|
assert result["step_id"] == "user"
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.xiaomi_ble.config_flow.async_process_advertisements",
|
"homeassistant.components.xiaomi_ble.config_flow.async_process_advertisements",
|
||||||
side_effect=asyncio.TimeoutError(),
|
side_effect=TimeoutError(),
|
||||||
):
|
):
|
||||||
result2 = await hass.config_entries.flow.async_configure(
|
result2 = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"],
|
result["flow_id"],
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""The tests for the Yandex SpeechKit speech platform."""
|
"""The tests for the Yandex SpeechKit speech platform."""
|
||||||
import asyncio
|
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -201,7 +200,7 @@ async def test_service_say_timeout(
|
||||||
aioclient_mock.get(
|
aioclient_mock.get(
|
||||||
URL,
|
URL,
|
||||||
status=HTTPStatus.OK,
|
status=HTTPStatus.OK,
|
||||||
exc=asyncio.TimeoutError(),
|
exc=TimeoutError(),
|
||||||
params=url_param,
|
params=url_param,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""Test Yeelight."""
|
"""Test Yeelight."""
|
||||||
import asyncio
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from unittest.mock import AsyncMock, patch
|
from unittest.mock import AsyncMock, patch
|
||||||
|
|
||||||
|
@ -571,7 +570,7 @@ async def test_oserror_on_first_update_results_in_unavailable(
|
||||||
assert hass.states.get("light.test_name").state == STATE_UNAVAILABLE
|
assert hass.states.get("light.test_name").state == STATE_UNAVAILABLE
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("exception", [BulbException, asyncio.TimeoutError])
|
@pytest.mark.parametrize("exception", [BulbException, TimeoutError])
|
||||||
async def test_non_oserror_exception_on_first_update(
|
async def test_non_oserror_exception_on_first_update(
|
||||||
hass: HomeAssistant, exception: Exception
|
hass: HomeAssistant, exception: Exception
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""Test the Yeelight light."""
|
"""Test the Yeelight light."""
|
||||||
import asyncio
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
import socket
|
import socket
|
||||||
|
@ -504,7 +503,7 @@ async def test_services(hass: HomeAssistant, caplog: pytest.LogCaptureFixture) -
|
||||||
)
|
)
|
||||||
assert hass.states.get(ENTITY_LIGHT).state == STATE_OFF
|
assert hass.states.get(ENTITY_LIGHT).state == STATE_OFF
|
||||||
|
|
||||||
mocked_bulb.async_set_brightness = AsyncMock(side_effect=asyncio.TimeoutError)
|
mocked_bulb.async_set_brightness = AsyncMock(side_effect=TimeoutError)
|
||||||
with pytest.raises(HomeAssistantError):
|
with pytest.raises(HomeAssistantError):
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
"light",
|
"light",
|
||||||
|
@ -553,7 +552,7 @@ async def test_update_errors(
|
||||||
|
|
||||||
# Timeout usually means the bulb is overloaded with commands
|
# Timeout usually means the bulb is overloaded with commands
|
||||||
# but will still respond eventually.
|
# but will still respond eventually.
|
||||||
mocked_bulb.async_turn_off = AsyncMock(side_effect=asyncio.TimeoutError)
|
mocked_bulb.async_turn_off = AsyncMock(side_effect=TimeoutError)
|
||||||
with pytest.raises(HomeAssistantError):
|
with pytest.raises(HomeAssistantError):
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
"light",
|
"light",
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""Test yolink config flow."""
|
"""Test yolink config flow."""
|
||||||
import asyncio
|
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
@ -127,7 +126,7 @@ async def test_abort_if_authorization_timeout(
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.yolink.config_entry_oauth2_flow."
|
"homeassistant.components.yolink.config_entry_oauth2_flow."
|
||||||
"LocalOAuth2Implementation.async_generate_authorize_url",
|
"LocalOAuth2Implementation.async_generate_authorize_url",
|
||||||
side_effect=asyncio.TimeoutError,
|
side_effect=TimeoutError,
|
||||||
):
|
):
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""Test ZHA Core cluster handlers."""
|
"""Test ZHA Core cluster handlers."""
|
||||||
import asyncio
|
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
|
@ -564,12 +563,12 @@ async def test_ep_cluster_handlers_configure(cluster_handler) -> None:
|
||||||
ch_1 = cluster_handler(zha_const.CLUSTER_HANDLER_ON_OFF, 6)
|
ch_1 = cluster_handler(zha_const.CLUSTER_HANDLER_ON_OFF, 6)
|
||||||
ch_2 = cluster_handler(zha_const.CLUSTER_HANDLER_LEVEL, 8)
|
ch_2 = cluster_handler(zha_const.CLUSTER_HANDLER_LEVEL, 8)
|
||||||
ch_3 = cluster_handler(zha_const.CLUSTER_HANDLER_COLOR, 768)
|
ch_3 = cluster_handler(zha_const.CLUSTER_HANDLER_COLOR, 768)
|
||||||
ch_3.async_configure = AsyncMock(side_effect=asyncio.TimeoutError)
|
ch_3.async_configure = AsyncMock(side_effect=TimeoutError)
|
||||||
ch_3.async_initialize = AsyncMock(side_effect=asyncio.TimeoutError)
|
ch_3.async_initialize = AsyncMock(side_effect=TimeoutError)
|
||||||
ch_4 = cluster_handler(zha_const.CLUSTER_HANDLER_ON_OFF, 6)
|
ch_4 = cluster_handler(zha_const.CLUSTER_HANDLER_ON_OFF, 6)
|
||||||
ch_5 = cluster_handler(zha_const.CLUSTER_HANDLER_LEVEL, 8)
|
ch_5 = cluster_handler(zha_const.CLUSTER_HANDLER_LEVEL, 8)
|
||||||
ch_5.async_configure = AsyncMock(side_effect=asyncio.TimeoutError)
|
ch_5.async_configure = AsyncMock(side_effect=TimeoutError)
|
||||||
ch_5.async_initialize = AsyncMock(side_effect=asyncio.TimeoutError)
|
ch_5.async_initialize = AsyncMock(side_effect=TimeoutError)
|
||||||
|
|
||||||
endpoint_mock = mock.MagicMock(spec_set=ZigpyEndpoint)
|
endpoint_mock = mock.MagicMock(spec_set=ZigpyEndpoint)
|
||||||
type(endpoint_mock).in_clusters = mock.PropertyMock(return_value={})
|
type(endpoint_mock).in_clusters = mock.PropertyMock(return_value={})
|
||||||
|
@ -959,7 +958,7 @@ async def test_quirk_id_cluster_handler(hass: HomeAssistant, caplog) -> None:
|
||||||
zigpy.exceptions.ZigbeeException("Zigbee exception"),
|
zigpy.exceptions.ZigbeeException("Zigbee exception"),
|
||||||
"Failed to send request: Zigbee exception",
|
"Failed to send request: Zigbee exception",
|
||||||
),
|
),
|
||||||
(asyncio.TimeoutError(), "Failed to send request: device did not respond"),
|
(TimeoutError(), "Failed to send request: device did not respond"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_retry_request(
|
async def test_retry_request(
|
||||||
|
|
|
@ -835,7 +835,7 @@ async def test_shade(
|
||||||
assert hass.states.get(entity_id).state == STATE_OPEN
|
assert hass.states.get(entity_id).state == STATE_OPEN
|
||||||
|
|
||||||
# test cover stop
|
# test cover stop
|
||||||
with patch("zigpy.zcl.Cluster.request", side_effect=asyncio.TimeoutError):
|
with patch("zigpy.zcl.Cluster.request", side_effect=TimeoutError):
|
||||||
with pytest.raises(HomeAssistantError):
|
with pytest.raises(HomeAssistantError):
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
COVER_DOMAIN,
|
COVER_DOMAIN,
|
||||||
|
@ -924,7 +924,7 @@ async def test_keen_vent(
|
||||||
assert hass.states.get(entity_id).state == STATE_CLOSED
|
assert hass.states.get(entity_id).state == STATE_CLOSED
|
||||||
|
|
||||||
# open from UI command fails
|
# open from UI command fails
|
||||||
p1 = patch.object(cluster_on_off, "request", side_effect=asyncio.TimeoutError)
|
p1 = patch.object(cluster_on_off, "request", side_effect=TimeoutError)
|
||||||
p2 = patch.object(cluster_level, "request", return_value=[4, 0])
|
p2 = patch.object(cluster_level, "request", return_value=[4, 0])
|
||||||
|
|
||||||
with p1, p2:
|
with p1, p2:
|
||||||
|
|
|
@ -198,7 +198,7 @@ async def test_gateway_group_methods(
|
||||||
# the group entity should not have been cleaned up
|
# the group entity should not have been cleaned up
|
||||||
assert entity_id not in hass.states.async_entity_ids(Platform.LIGHT)
|
assert entity_id not in hass.states.async_entity_ids(Platform.LIGHT)
|
||||||
|
|
||||||
with patch("zigpy.zcl.Cluster.request", side_effect=asyncio.TimeoutError):
|
with patch("zigpy.zcl.Cluster.request", side_effect=TimeoutError):
|
||||||
await zha_group.members[0].async_remove_from_group()
|
await zha_group.members[0].async_remove_from_group()
|
||||||
assert len(zha_group.members) == 1
|
assert len(zha_group.members) == 1
|
||||||
for member in zha_group.members:
|
for member in zha_group.members:
|
||||||
|
|
|
@ -374,7 +374,7 @@ async def test_supervisor_discovery(
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("discovery_info", "server_version_side_effect"),
|
("discovery_info", "server_version_side_effect"),
|
||||||
[({"config": ADDON_DISCOVERY_INFO}, asyncio.TimeoutError())],
|
[({"config": ADDON_DISCOVERY_INFO}, TimeoutError())],
|
||||||
)
|
)
|
||||||
async def test_supervisor_discovery_cannot_connect(
|
async def test_supervisor_discovery_cannot_connect(
|
||||||
hass: HomeAssistant, supervisor, get_addon_discovery_info
|
hass: HomeAssistant, supervisor, get_addon_discovery_info
|
||||||
|
@ -1114,7 +1114,7 @@ async def test_addon_running(
|
||||||
(
|
(
|
||||||
{"config": ADDON_DISCOVERY_INFO},
|
{"config": ADDON_DISCOVERY_INFO},
|
||||||
None,
|
None,
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
None,
|
None,
|
||||||
"cannot_connect",
|
"cannot_connect",
|
||||||
),
|
),
|
||||||
|
@ -1366,7 +1366,7 @@ async def test_addon_installed_start_failure(
|
||||||
[
|
[
|
||||||
(
|
(
|
||||||
{"config": ADDON_DISCOVERY_INFO},
|
{"config": ADDON_DISCOVERY_INFO},
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
None,
|
None,
|
||||||
|
|
Loading…
Add table
Reference in a new issue