1 """Coordinator for the venstar component."""
3 from __future__
import annotations
6 from datetime
import timedelta
8 from requests
import RequestException
9 from venstarcolortouch
import VenstarColorTouch
14 from .const
import _LOGGER, DOMAIN, VENSTAR_SLEEP
18 """Class to manage fetching Venstar data."""
24 venstar_connection: VenstarColorTouch,
26 """Initialize global Venstar data updater."""
33 self.
clientclient = venstar_connection
34 self.
runtimesruntimes: list[dict[str, int]] = []
37 """Update the state."""
39 await self.hass.async_add_executor_job(self.
clientclient.update_info)
40 except (OSError, RequestException)
as ex:
41 raise update_coordinator.UpdateFailed(
42 f
"Exception during Venstar info update: {ex}"
46 await asyncio.sleep(VENSTAR_SLEEP)
49 await self.hass.async_add_executor_job(self.
clientclient.update_sensors)
50 except (OSError, RequestException)
as ex:
51 raise update_coordinator.UpdateFailed(
52 f
"Exception during Venstar sensor update: {ex}"
56 await asyncio.sleep(VENSTAR_SLEEP)
59 await self.hass.async_add_executor_job(self.
clientclient.update_alerts)
60 except (OSError, RequestException)
as ex:
61 raise update_coordinator.UpdateFailed(
62 f
"Exception during Venstar alert update: {ex}"
66 await asyncio.sleep(VENSTAR_SLEEP)
69 self.
runtimesruntimes = await self.hass.async_add_executor_job(
70 self.
clientclient.get_runtimes
72 except (OSError, RequestException)
as ex:
73 raise update_coordinator.UpdateFailed(
74 f
"Exception during Venstar runtime update: {ex}"
None _async_update_data(self)
None __init__(self, HomeAssistant hass, *VenstarColorTouch venstar_connection)