Home Assistant Unofficial Reference
2024.12.1
utils.py
Go to the documentation of this file.
1
"""Utility functions for Aqualink devices."""
2
3
from
__future__
import
annotations
4
5
from
collections.abc
import
Awaitable
6
7
import
httpx
8
from
iaqualink.exception
import
AqualinkServiceException
9
10
from
homeassistant.exceptions
import
HomeAssistantError
11
12
13
async
def
await_or_reraise
(awaitable: Awaitable) ->
None
:
14
"""Execute API call while catching service exceptions."""
15
try
:
16
await awaitable
17
except
(AqualinkServiceException, httpx.HTTPError)
as
svc_exception:
18
raise
HomeAssistantError
(f
"Aqualink error: {svc_exception}"
)
from
svc_exception
homeassistant.exceptions.HomeAssistantError
Definition:
exceptions.py:34
homeassistant.components.iaqualink.utils.await_or_reraise
None await_or_reraise(Awaitable awaitable)
Definition:
utils.py:13
homeassistant.exceptions
Definition:
exceptions.py:1
core
homeassistant
components
iaqualink
utils.py
Generated by
1.9.1