Fix wemo push updates delaying shutdown (#116333)

pull/116317/head^2
J. Nick Koston 2024-04-28 08:14:45 -05:00 committed by GitHub
parent 006040270c
commit c3aa238a33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 1 deletions

View File

@ -5,6 +5,7 @@ from __future__ import annotations
import asyncio
from dataclasses import dataclass, fields
from datetime import timedelta
from functools import partial
import logging
from typing import TYPE_CHECKING, Literal
@ -130,7 +131,14 @@ class DeviceCoordinator(DataUpdateCoordinator[None]): # pylint: disable=hass-en
)
else:
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:
"""Unregister push subscriptions and remove from coordinators dict."""