1 """The Aseko Pool Live integration."""
3 from __future__
import annotations
7 from aioaseko
import Aseko, AsekoNotLoggedIn
13 from .coordinator
import AsekoConfigEntry, AsekoDataUpdateCoordinator
15 _LOGGER = logging.getLogger(__name__)
17 PLATFORMS: list[str] = [Platform.BINARY_SENSOR, Platform.SENSOR]
21 """Set up Aseko Pool Live from a config entry."""
22 aseko = Aseko(entry.data[CONF_EMAIL], entry.data[CONF_PASSWORD])
26 except AsekoNotLoggedIn
as err:
27 raise ConfigEntryAuthFailed
from err
30 await coordinator.async_config_entry_first_refresh()
31 entry.runtime_data = coordinator
32 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
37 """Unload a config entry."""
38 return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
42 hass: HomeAssistant, config_entry: AsekoConfigEntry
44 """Migrate old entry."""
45 _LOGGER.debug(
"Migrating from version %s", config_entry.version)
47 if config_entry.version == 1:
49 CONF_EMAIL: config_entry.title,
53 hass.config_entries.async_update_entry(config_entry, data=new, version=2)
55 _LOGGER.debug(
"Migration to version %s successful", config_entry.version)
58 _LOGGER.error(
"Attempt to migrate from unknown version %s", config_entry.version)
bool async_setup_entry(HomeAssistant hass, AsekoConfigEntry entry)
bool async_migrate_entry(HomeAssistant hass, AsekoConfigEntry config_entry)
bool async_unload_entry(HomeAssistant hass, AsekoConfigEntry entry)