mirror of
https://github.com/home-assistant/core.git
synced 2025-06-16 11:07:05 +00:00
Fix wemo push updates delaying shutdown (#116333)
This commit is contained in:
parent
1309fc5eda
commit
c3cb79e0e9
@ -5,6 +5,7 @@ from __future__ import annotations
|
|||||||
import asyncio
|
import asyncio
|
||||||
from dataclasses import dataclass, fields
|
from dataclasses import dataclass, fields
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
from functools import partial
|
||||||
import logging
|
import logging
|
||||||
from typing import TYPE_CHECKING, Literal
|
from typing import TYPE_CHECKING, Literal
|
||||||
|
|
||||||
@ -130,7 +131,14 @@ class DeviceCoordinator(DataUpdateCoordinator[None]): # pylint: disable=hass-en
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
updated = self.wemo.subscription_update(event_type, params)
|
updated = self.wemo.subscription_update(event_type, params)
|
||||||
self.hass.create_task(self._async_subscription_callback(updated))
|
self.hass.loop.call_soon_threadsafe(
|
||||||
|
partial(
|
||||||
|
self.hass.async_create_background_task,
|
||||||
|
self._async_subscription_callback(updated),
|
||||||
|
f"{self.name} subscription_callback",
|
||||||
|
eager_start=True,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
async def async_shutdown(self) -> None:
|
async def async_shutdown(self) -> None:
|
||||||
"""Unregister push subscriptions and remove from coordinators dict."""
|
"""Unregister push subscriptions and remove from coordinators dict."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user