mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 02:07:54 +00:00
Add run_immediately to bluetooth listeners (#113659)
This commit is contained in:
parent
1f9c8694a8
commit
5e8265d8a4
@ -166,7 +166,9 @@ async def _async_start_adapter_discovery(
|
|||||||
"""Shutdown debouncer."""
|
"""Shutdown debouncer."""
|
||||||
discovery_debouncer.async_shutdown()
|
discovery_debouncer.async_shutdown()
|
||||||
|
|
||||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _async_shutdown_debouncer)
|
hass.bus.async_listen_once(
|
||||||
|
EVENT_HOMEASSISTANT_STOP, _async_shutdown_debouncer, run_immediately=True
|
||||||
|
)
|
||||||
|
|
||||||
async def _async_call_debouncer(now: datetime.datetime) -> None:
|
async def _async_call_debouncer(now: datetime.datetime) -> None:
|
||||||
"""Call the debouncer at a later time."""
|
"""Call the debouncer at a later time."""
|
||||||
@ -197,7 +199,9 @@ async def _async_start_adapter_discovery(
|
|||||||
|
|
||||||
cancel = usb.async_register_scan_request_callback(hass, _async_trigger_discovery)
|
cancel = usb.async_register_scan_request_callback(hass, _async_trigger_discovery)
|
||||||
hass.bus.async_listen_once(
|
hass.bus.async_listen_once(
|
||||||
EVENT_HOMEASSISTANT_STOP, hass_callback(lambda event: cancel())
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
|
hass_callback(lambda event: cancel()),
|
||||||
|
run_immediately=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,9 +135,11 @@ class HomeAssistantBluetoothManager(BluetoothManager):
|
|||||||
self._bluetooth_adapters, self.storage
|
self._bluetooth_adapters, self.storage
|
||||||
)
|
)
|
||||||
self._cancel_logging_listener = self.hass.bus.async_listen(
|
self._cancel_logging_listener = self.hass.bus.async_listen(
|
||||||
EVENT_LOGGING_CHANGED, self._async_logging_changed
|
EVENT_LOGGING_CHANGED, self._async_logging_changed, run_immediately=True
|
||||||
|
)
|
||||||
|
self.hass.bus.async_listen_once(
|
||||||
|
EVENT_HOMEASSISTANT_STOP, self.async_stop, run_immediately=True
|
||||||
)
|
)
|
||||||
self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, self.async_stop)
|
|
||||||
seen: set[str] = set()
|
seen: set[str] = set()
|
||||||
for address, service_info in itertools.chain(
|
for address, service_info in itertools.chain(
|
||||||
self._connectable_history.items(), self._all_history.items()
|
self._connectable_history.items(), self._all_history.items()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user