Skip to content

Commit

Permalink
Switch ESPHome Bluetooth to use loop.create_future() (#100010)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Sep 9, 2023
1 parent b66437f commit b370244
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion homeassistant/components/esphome/bluetooth/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class ESPHomeBluetoothDevice:
_ble_connection_free_futures: list[asyncio.Future[int]] = field(
default_factory=list
)
loop: asyncio.AbstractEventLoop = field(default_factory=asyncio.get_running_loop)

@callback
def async_update_ble_connection_limits(self, free: int, limit: int) -> None:
Expand Down Expand Up @@ -49,6 +50,6 @@ async def wait_for_ble_connections_free(self) -> int:
"""Wait until there are free BLE connections."""
if self.ble_connections_free > 0:
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)
return await fut

0 comments on commit b370244

Please sign in to comment.