1 """DataUpdateCoordinator for Elgato."""
3 from dataclasses
import dataclass
5 from elgato
import BatteryInfo, Elgato, ElgatoConnectionError, Info, Settings, State
13 from .const
import DOMAIN, LOGGER, SCAN_INTERVAL
18 """Elgato data stored in the DataUpdateCoordinator."""
20 battery: BatteryInfo |
None
27 """Class to manage fetching Elgato data."""
29 config_entry: ConfigEntry
30 has_battery: bool |
None =
None
32 def __init__(self, hass: HomeAssistant, entry: ConfigEntry) ->
None:
33 """Initialize the coordinator."""
36 entry.data[CONF_HOST],
37 port=entry.data[CONF_PORT],
43 name=f
"{DOMAIN}_{entry.data[CONF_HOST]}",
44 update_interval=SCAN_INTERVAL,
48 """Fetch data from the Elgato device."""
54 battery=await self.
clientclient.battery()
if self.
has_batteryhas_battery
else None,
55 info=await self.
clientclient.info(),
56 settings=await self.
clientclient.settings(),
59 except ElgatoConnectionError
as err:
ElgatoData _async_update_data(self)
None __init__(self, HomeAssistant hass, ConfigEntry entry)
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)
bool state(HomeAssistant hass, str|State|None entity, Any req_state, timedelta|None for_period=None, str|None attribute=None, TemplateVarsType variables=None)