1 """The Huum integration."""
3 from __future__
import annotations
7 from huum.exceptions
import Forbidden, NotAuthenticated
8 from huum.huum
import Huum
16 from .const
import DOMAIN, PLATFORMS
18 _LOGGER = logging.getLogger(__name__)
22 """Set up Huum from a config entry."""
23 username = entry.data[CONF_USERNAME]
24 password = entry.data[CONF_PASSWORD]
30 except (Forbidden, NotAuthenticated)
as err:
31 _LOGGER.error(
"Could not log in to Huum with given credentials")
33 "Could not log in to Huum with given credentials"
36 hass.data.setdefault(DOMAIN, {})[entry.entry_id] = huum
38 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
43 """Unload a config entry."""
44 if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
45 hass.data[DOMAIN].pop(entry.entry_id)
bool async_unload_entry(HomeAssistant hass, ConfigEntry entry)
bool async_setup_entry(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)