mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Set config_entry explicitly in todoist coordinator (#129421)
This commit is contained in:
parent
b8f2583bc3
commit
2052579efc
@ -25,7 +25,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
|
||||
token = entry.data[CONF_TOKEN]
|
||||
api = TodoistAPIAsync(token)
|
||||
coordinator = TodoistCoordinator(hass, _LOGGER, SCAN_INTERVAL, api, token)
|
||||
coordinator = TodoistCoordinator(hass, _LOGGER, entry, SCAN_INTERVAL, api, token)
|
||||
await coordinator.async_config_entry_first_refresh()
|
||||
|
||||
hass.data.setdefault(DOMAIN, {})
|
||||
|
@ -142,7 +142,7 @@ async def async_setup_platform(
|
||||
project_id_lookup = {}
|
||||
|
||||
api = TodoistAPIAsync(token)
|
||||
coordinator = TodoistCoordinator(hass, _LOGGER, SCAN_INTERVAL, api, token)
|
||||
coordinator = TodoistCoordinator(hass, _LOGGER, None, SCAN_INTERVAL, api, token)
|
||||
await coordinator.async_refresh()
|
||||
|
||||
async def _shutdown_coordinator(_: Event) -> None:
|
||||
|
@ -6,6 +6,7 @@ import logging
|
||||
from todoist_api_python.api_async import TodoistAPIAsync
|
||||
from todoist_api_python.models import Label, Project, Section, Task
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
|
||||
@ -17,12 +18,19 @@ class TodoistCoordinator(DataUpdateCoordinator[list[Task]]):
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
logger: logging.Logger,
|
||||
entry: ConfigEntry | None,
|
||||
update_interval: timedelta,
|
||||
api: TodoistAPIAsync,
|
||||
token: str,
|
||||
) -> None:
|
||||
"""Initialize the Todoist coordinator."""
|
||||
super().__init__(hass, logger, name="Todoist", update_interval=update_interval)
|
||||
super().__init__(
|
||||
hass,
|
||||
logger,
|
||||
config_entry=entry,
|
||||
name="Todoist",
|
||||
update_interval=update_interval,
|
||||
)
|
||||
self.api = api
|
||||
self._projects: list[Project] | None = None
|
||||
self._labels: list[Label] | None = None
|
||||
|
Loading…
x
Reference in New Issue
Block a user