From e88dfd4f6870644243c8737ed29ec0ff4df7fada Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 21 Feb 2024 21:03:22 -0600 Subject: [PATCH] Migrate Bluetooth coordinators to use Debouncer async_schedule_call (#111077) * Switch Bluetooth to use Debouncer async_schedule_call If the debouncer does not fire the underlying call no task has to be scheduled * revert change in init * revert change in init * revert change in init --- homeassistant/components/bluetooth/active_update_coordinator.py | 2 +- homeassistant/components/bluetooth/active_update_processor.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/bluetooth/active_update_coordinator.py b/homeassistant/components/bluetooth/active_update_coordinator.py index 174e5c66ce8..cf8590079bc 100644 --- a/homeassistant/components/bluetooth/active_update_coordinator.py +++ b/homeassistant/components/bluetooth/active_update_coordinator.py @@ -168,7 +168,7 @@ class ActiveBluetoothDataUpdateCoordinator( # We use bluetooth events to trigger the poll so that we scan as soon as # possible after a device comes online or back in range, if a poll is due if self.needs_poll(service_info): - self.hass.async_create_task(self._debounced_poll.async_call()) + self._debounced_poll.async_schedule_call() @callback def _async_stop(self) -> None: diff --git a/homeassistant/components/bluetooth/active_update_processor.py b/homeassistant/components/bluetooth/active_update_processor.py index 3a13dda28a8..d0be6c61811 100644 --- a/homeassistant/components/bluetooth/active_update_processor.py +++ b/homeassistant/components/bluetooth/active_update_processor.py @@ -157,7 +157,7 @@ class ActiveBluetoothProcessorCoordinator( # We use bluetooth events to trigger the poll so that we scan as soon as # possible after a device comes online or back in range, if a poll is due if self.needs_poll(service_info): - self.hass.async_create_task(self._debounced_poll.async_call()) + self._debounced_poll.async_schedule_call() @callback def _async_stop(self) -> None: