mirror of
https://github.com/home-assistant/core.git
synced 2025-08-07 06:35:10 +02:00
Switch ESPHome Bluetooth to use loop.create_future() (#100010)
This commit is contained in:
@@ -21,6 +21,7 @@ class ESPHomeBluetoothDevice:
|
|||||||
_ble_connection_free_futures: list[asyncio.Future[int]] = field(
|
_ble_connection_free_futures: list[asyncio.Future[int]] = field(
|
||||||
default_factory=list
|
default_factory=list
|
||||||
)
|
)
|
||||||
|
loop: asyncio.AbstractEventLoop = field(default_factory=asyncio.get_running_loop)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_update_ble_connection_limits(self, free: int, limit: int) -> None:
|
def async_update_ble_connection_limits(self, free: int, limit: int) -> None:
|
||||||
@@ -49,6 +50,6 @@ class ESPHomeBluetoothDevice:
|
|||||||
"""Wait until there are free BLE connections."""
|
"""Wait until there are free BLE connections."""
|
||||||
if self.ble_connections_free > 0:
|
if self.ble_connections_free > 0:
|
||||||
return self.ble_connections_free
|
return self.ble_connections_free
|
||||||
fut: asyncio.Future[int] = asyncio.Future()
|
fut: asyncio.Future[int] = self.loop.create_future()
|
||||||
self._ble_connection_free_futures.append(fut)
|
self._ble_connection_free_futures.append(fut)
|
||||||
return await fut
|
return await fut
|
||||||
|
Reference in New Issue
Block a user