1 """Support for the Skybell HD Doorbell."""
3 from __future__
import annotations
7 from aioskybell
import Skybell
8 from aioskybell.exceptions
import SkybellAuthenticationException, SkybellException
16 from .const
import DOMAIN
17 from .coordinator
import SkybellDataUpdateCoordinator
20 Platform.BINARY_SENSOR,
29 """Set up Skybell from a config entry."""
30 email = entry.data[CONF_EMAIL]
31 password = entry.data[CONF_PASSWORD]
37 cache_path=hass.config.path(f
"./skybell_{entry.unique_id}.pickle"),
41 devices = await api.async_initialize()
42 except SkybellAuthenticationException
as ex:
43 raise ConfigEntryAuthFailed
from ex
44 except SkybellException
as ex:
47 device_coordinators: list[SkybellDataUpdateCoordinator] = [
52 coordinator.async_config_entry_first_refresh()
53 for coordinator
in device_coordinators
56 hass.data.setdefault(DOMAIN, {})[entry.entry_id] = device_coordinators
57 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
63 """Unload a config entry."""
64 if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
65 hass.data[DOMAIN].pop(entry.entry_id)
bool async_setup_entry(HomeAssistant hass, ConfigEntry entry)
bool async_unload_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)