1 """Datacoordinator for InComfort integration."""
3 from dataclasses
import dataclass, field
4 from datetime
import timedelta
8 from aiohttp
import ClientResponseError
9 from incomfortclient
import (
10 Gateway
as InComfortGateway,
11 Heater
as InComfortHeater,
21 _LOGGER = logging.getLogger(__name__)
28 """Keep the Intergas InComfort entry data."""
30 client: InComfortGateway
31 heaters: list[InComfortHeater] = field(default_factory=list)
36 entry_data: dict[str, Any],
38 """Validate the configuration."""
39 credentials =
dict(entry_data)
40 hostname = credentials.pop(CONF_HOST)
42 client = InComfortGateway(
45 heaters = await client.heaters()
51 """Data coordinator for InComfort entities."""
53 def __init__(self, hass: HomeAssistant, incomfort_data: InComfortData) ->
None:
54 """Initialize coordinator."""
58 name=
"InComfort datacoordinator",
59 update_interval=
timedelta(seconds=UPDATE_INTERVAL),
64 """Fetch data from API endpoint."""
68 except TimeoutError
as exc:
69 raise UpdateFailed
from exc
70 except IncomfortError
as exc:
71 if isinstance(exc.message, ClientResponseError):
72 if exc.message.status == 401:
74 raise UpdateFailed
from exc
InComfortData _async_update_data(self)
None __init__(self, HomeAssistant hass, InComfortData incomfort_data)
InComfortData async_connect_gateway(HomeAssistant hass, dict[str, Any] entry_data)
aiohttp.ClientSession async_get_clientsession(HomeAssistant hass, bool verify_ssl=True, socket.AddressFamily family=socket.AF_UNSPEC, ssl_util.SSLCipherList ssl_cipher=ssl_util.SSLCipherList.PYTHON_DEFAULT)