Fix lingering timer in device registry (#89422)
This commit is contained in:
parent
f4b8598979
commit
029093d0b2
1 changed files with 8 additions and 1 deletions
|
@ -10,7 +10,7 @@ from typing import TYPE_CHECKING, Any, TypeVar, cast
|
|||
import attr
|
||||
|
||||
from homeassistant.backports.enum import StrEnum
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_STARTED
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_STARTED, EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import Event, HomeAssistant, callback
|
||||
from homeassistant.exceptions import HomeAssistantError, RequiredParameterMissing
|
||||
from homeassistant.loader import bind_hass
|
||||
|
@ -907,6 +907,13 @@ def async_setup_cleanup(hass: HomeAssistant, dev_reg: DeviceRegistry) -> None:
|
|||
|
||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STARTED, startup_clean)
|
||||
|
||||
@callback
|
||||
def _on_homeassistant_stop(event: Event) -> None:
|
||||
"""Cancel debounced cleanup."""
|
||||
debounced_cleanup.async_cancel()
|
||||
|
||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _on_homeassistant_stop)
|
||||
|
||||
|
||||
def _normalize_connections(connections: set[tuple[str, str]]) -> set[tuple[str, str]]:
|
||||
"""Normalize connections to ensure we can match mac addresses."""
|
||||
|
|
Loading…
Add table
Reference in a new issue