1 """The Bring! integration."""
3 from __future__
import annotations
7 from bring_api
import (
11 BringRequestException,
20 from .const
import DOMAIN
21 from .coordinator
import BringDataUpdateCoordinator
23 PLATFORMS: list[Platform] = [Platform.SENSOR, Platform.TODO]
25 _LOGGER = logging.getLogger(__name__)
27 type BringConfigEntry = ConfigEntry[BringDataUpdateCoordinator]
31 """Set up Bring! from a config entry."""
33 email = entry.data[CONF_EMAIL]
34 password = entry.data[CONF_PASSWORD]
37 bring = Bring(session, email, password)
41 except BringRequestException
as e:
43 translation_domain=DOMAIN,
44 translation_key=
"setup_request_exception",
46 except BringParseException
as e:
48 translation_domain=DOMAIN,
49 translation_key=
"setup_parse_exception",
51 except BringAuthException
as e:
53 translation_domain=DOMAIN,
54 translation_key=
"setup_authentication_exception",
55 translation_placeholders={CONF_EMAIL: email},
59 await coordinator.async_config_entry_first_refresh()
61 entry.runtime_data = coordinator
63 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
69 """Unload a config entry."""
70 return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
bool async_unload_entry(HomeAssistant hass, ConfigEntry entry)
bool async_setup_entry(HomeAssistant hass, BringConfigEntry 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)