1 """The todoist integration."""
6 from todoist_api_python.api_async
import TodoistAPIAsync
12 from .const
import DOMAIN
13 from .coordinator
import TodoistCoordinator
15 _LOGGER = logging.getLogger(__name__)
17 SCAN_INTERVAL = datetime.timedelta(minutes=1)
20 PLATFORMS: list[Platform] = [Platform.CALENDAR, Platform.TODO]
24 """Set up todoist from a config entry."""
26 token = entry.data[CONF_TOKEN]
27 api = TodoistAPIAsync(token)
29 await coordinator.async_config_entry_first_refresh()
31 hass.data.setdefault(DOMAIN, {})
32 hass.data[DOMAIN][entry.entry_id] = coordinator
34 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
40 """Unload a config entry."""
41 if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
42 hass.data[DOMAIN].pop(entry.entry_id)
bool async_unload_entry(HomeAssistant hass, ConfigEntry entry)
bool async_setup_entry(HomeAssistant hass, ConfigEntry entry)