1 """Data update coordinator for the Enigma2 integration."""
5 from openwebif.api
import OpenWebIfDevice, OpenWebIfStatus
22 CONNECTION_NETWORK_MAC,
29 from .const
import CONF_SOURCE_BOUQUET, DOMAIN
31 LOGGER = logging.getLogger(__package__)
35 """The Enigma2 data update coordinator."""
37 device: OpenWebIfDevice
39 def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry) ->
None:
40 """Initialize the Enigma2 data update coordinator."""
43 hass, logger=LOGGER, name=DOMAIN, update_interval=DEFAULT_SCAN_INTERVAL
47 scheme=
"http" if not config_entry.data[CONF_SSL]
else "https",
48 host=config_entry.data[CONF_HOST],
49 port=config_entry.data[CONF_PORT],
50 user=config_entry.data.get(CONF_USERNAME),
51 password=config_entry.data.get(CONF_PASSWORD),
55 hass, verify_ssl=config_entry.data[CONF_VERIFY_SSL], base_url=base_url
59 session, source_bouquet=config_entry.options.get(CONF_SOURCE_BOUQUET)
63 configuration_url=base_url,
64 name=config_entry.data[CONF_HOST],
68 """Provide needed data to the device info."""
70 about = await self.
devicedevice.get_about()
71 self.
devicedevice.mac_address = about[
"info"][
"ifaces"][0][
"mac"]
72 self.
device_infodevice_info[
"model"] = about[
"info"][
"model"]
73 self.
device_infodevice_info[
"manufacturer"] = about[
"info"][
"brand"]
76 for iface
in about[
"info"][
"ifaces"]
77 if "mac" in iface
and iface[
"mac"]
is not None
80 (CONNECTION_NETWORK_MAC,
format_mac(iface[
"mac"]))
81 for iface
in about[
"info"][
"ifaces"]
82 if "mac" in iface
and iface[
"mac"]
is not None
87 return self.
devicedevice.status
OpenWebIfStatus _async_update_data(self)
None __init__(self, HomeAssistant hass, ConfigEntry config_entry)
IssData update(pyiss.ISS iss)
aiohttp.ClientSession async_create_clientsession()