1 """The LaCrosse View integration."""
3 from __future__
import annotations
7 from lacrosse_view
import LaCrosse, LoginError
15 from .const
import DOMAIN
16 from .coordinator
import LaCrosseUpdateCoordinator
18 PLATFORMS: list[Platform] = [Platform.SENSOR]
19 _LOGGER = logging.getLogger(__name__)
23 """Set up LaCrosse View from a config entry."""
28 await api.login(entry.data[
"username"], entry.data[
"password"])
29 _LOGGER.debug(
"Log in successful")
30 except LoginError
as error:
31 raise ConfigEntryAuthFailed
from error
35 _LOGGER.debug(
"First refresh")
36 await coordinator.async_config_entry_first_refresh()
38 hass.data.setdefault(DOMAIN, {})[entry.entry_id] = {
39 "coordinator": coordinator,
42 _LOGGER.debug(
"Setting up platforms")
43 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
49 """Unload a config entry."""
50 if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
51 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)