From 41f8f9fcad39c46f4708569d592a1799cb5ff2d2 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Sat, 22 Apr 2023 21:13:36 +0200 Subject: [PATCH] Fix lingering timer in yeelight SSDP discovery (#91694) --- homeassistant/components/yeelight/scanner.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/yeelight/scanner.py b/homeassistant/components/yeelight/scanner.py index f6d2d7fde78..8eb2991c9dc 100644 --- a/homeassistant/components/yeelight/scanner.py +++ b/homeassistant/components/yeelight/scanner.py @@ -16,7 +16,7 @@ from typing_extensions import Self from homeassistant import config_entries from homeassistant.components import network, ssdp -from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback +from homeassistant.core import CALLBACK_TYPE, HassJob, HomeAssistant, callback from homeassistant.helpers import discovery_flow from homeassistant.helpers.event import async_call_later, async_track_time_interval @@ -180,7 +180,9 @@ class YeelightScanner: # Delay starting the flow in case the discovery is the result # of another discovery - async_call_later(self._hass, 1, _async_start_flow) + async_call_later( + self._hass, 1, HassJob(_async_start_flow, cancel_on_shutdown=True) + ) @callback def _async_process_entry(self, headers: CaseInsensitiveDict) -> None: