1 """Define an update coordinator for OpenUV."""
3 from __future__
import annotations
5 from collections.abc
import Awaitable, Callable
6 from typing
import Any, cast
8 from pyopenuv.errors
import InvalidApiKeyError, OpenUvError
16 from .const
import LOGGER
18 DEFAULT_DEBOUNCER_COOLDOWN_SECONDS = 15 * 60
22 """Define an OpenUV data coordinator."""
24 config_entry: ConfigEntry
25 update_method: Callable[[], Awaitable[dict[str, Any]]]
35 update_method: Callable[[], Awaitable[dict[str, Any]]],
42 update_method=update_method,
46 cooldown=DEFAULT_DEBOUNCER_COOLDOWN_SECONDS,
56 """Fetch data from OpenUV."""
59 except InvalidApiKeyError
as err:
61 except OpenUvError
as err:
64 return cast(dict[str, Any], data[
"result"])
None __init__(self, HomeAssistant hass, *ConfigEntry entry, str name, str latitude, str longitude, Callable[[], Awaitable[dict[str, Any]]] update_method)
dict[str, Any] _async_update_data(self)