1 """Helper functions for the Webmin integration."""
3 from collections.abc
import Mapping
6 from webmin_xmlrpc.client
import WebminInstance
22 hass: HomeAssistant, options: Mapping[str, Any]
23 ) -> tuple[WebminInstance, URL]:
24 """Retrieve a Webmin instance and the base URL from config options."""
27 scheme=
"https" if options[CONF_SSL]
else "http",
28 user=options[CONF_USERNAME],
29 password=options[CONF_PASSWORD],
30 host=options[CONF_HOST],
31 port=
int(options[CONF_PORT]),
34 return WebminInstance(
37 verify_ssl=options[CONF_VERIFY_SSL],
44 """Return a sorted list of mac addresses."""
47 for iface
in data[
"active_interfaces"]
48 if "ether" in iface
and iface[
"name"].startswith((
"en",
"eth",
"wl"))
aiohttp.ClientSession async_create_clientsession()
tuple[WebminInstance, URL] get_instance_from_options(HomeAssistant hass, Mapping[str, Any] options)
list[str] get_sorted_mac_addresses(dict[str, Any] data)