1 """The Epion data coordinator."""
6 from epion
import Epion, EpionAuthenticationError, EpionConnectionError
12 from .const
import REFRESH_INTERVAL
14 _LOGGER = logging.getLogger(__name__)
18 """Epion data update coordinator."""
20 def __init__(self, hass: HomeAssistant, epion_api: Epion) ->
None:
21 """Initialize the Epion coordinator."""
26 update_interval=REFRESH_INTERVAL,
31 """Fetch data from Epion API and construct a dictionary with device IDs as keys."""
33 response = await self.
hasshass.async_add_executor_job(
36 except EpionAuthenticationError
as err:
37 _LOGGER.error(
"Authentication error with Epion API")
38 raise ConfigEntryAuthFailed
from err
39 except EpionConnectionError
as err:
40 _LOGGER.error(
"Epion API connection problem")
41 raise UpdateFailed(f
"Error communicating with API: {err}")
from err
43 for epion_device
in response[
"devices"]:
44 device_data[epion_device[
"deviceId"]] = epion_device
None __init__(self, HomeAssistant hass, Epion epion_api)
dict[str, Any] _async_update_data(self)