1 """The Aussie Broadband integration."""
3 from __future__
import annotations
5 from aiohttp
import ClientError
6 from aussiebb.asyncio
import AussieBB
7 from aussiebb.const
import FETCH_TYPES
8 from aussiebb.exceptions
import AuthenticationException
15 from .coordinator
import (
16 AussieBroadbandConfigEntry,
17 AussieBroadbandDataUpdateCoordinator,
20 PLATFORMS = [Platform.SENSOR]
24 hass: HomeAssistant, entry: AussieBroadbandConfigEntry
26 """Set up Aussie Broadband from a config entry."""
29 entry.data[CONF_USERNAME],
30 entry.data[CONF_PASSWORD],
35 ignore_types = [*FETCH_TYPES,
"Hardware"]
39 services = await client.get_services(drop_types=ignore_types)
40 except AuthenticationException
as exc:
41 raise ConfigEntryAuthFailed
from exc
42 except ClientError
as exc:
43 raise ConfigEntryNotReady
from exc
46 for service
in services:
48 hass, client, service[
"service_id"]
50 await service[
"coordinator"].async_config_entry_first_refresh()
53 entry.runtime_data = services
54 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
60 hass: HomeAssistant, entry: AussieBroadbandConfigEntry
62 """Unload the config entry."""
63 return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
bool async_setup_entry(HomeAssistant hass, AussieBroadbandConfigEntry entry)
bool async_unload_entry(HomeAssistant hass, AussieBroadbandConfigEntry 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)