Fix lingering timer in todoist (#91808)
This commit is contained in:
parent
93eac97983
commit
07aef27ea8
1 changed files with 7 additions and 2 deletions
|
@ -17,8 +17,8 @@ from homeassistant.components.calendar import (
|
|||
CalendarEntity,
|
||||
CalendarEvent,
|
||||
)
|
||||
from homeassistant.const import CONF_ID, CONF_NAME, CONF_TOKEN
|
||||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
from homeassistant.const import CONF_ID, CONF_NAME, CONF_TOKEN, EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import Event, HomeAssistant, ServiceCall
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
@ -122,6 +122,11 @@ async def async_setup_platform(
|
|||
coordinator = TodoistCoordinator(hass, _LOGGER, SCAN_INTERVAL, api)
|
||||
await coordinator.async_config_entry_first_refresh()
|
||||
|
||||
async def _shutdown_coordinator(_: Event) -> None:
|
||||
await coordinator.async_shutdown()
|
||||
|
||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _shutdown_coordinator)
|
||||
|
||||
# Setup devices:
|
||||
# Grab all projects.
|
||||
projects = await api.get_projects()
|
||||
|
|
Loading…
Add table
Reference in a new issue