mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00:00
Ensure esphome subscribes to bluetooth connection free before accepting connect requests (#90319)
This commit is contained in:
parent
916b274ec8
commit
8c9966aa05
@ -78,15 +78,18 @@ async def async_connect_scanner(
|
|||||||
scanner = ESPHomeScanner(
|
scanner = ESPHomeScanner(
|
||||||
hass, source, entry.title, new_info_callback, connector, connectable
|
hass, source, entry.title, new_info_callback, connector, connectable
|
||||||
)
|
)
|
||||||
|
if connectable:
|
||||||
|
# If its connectable be sure not to register the scanner
|
||||||
|
# until we know the connection is fully setup since otherwise
|
||||||
|
# there is a race condition where the connection can fail
|
||||||
|
await cli.subscribe_bluetooth_connections_free(
|
||||||
|
entry_data.async_update_ble_connection_limits
|
||||||
|
)
|
||||||
unload_callbacks = [
|
unload_callbacks = [
|
||||||
async_register_scanner(hass, scanner, connectable),
|
async_register_scanner(hass, scanner, connectable),
|
||||||
scanner.async_setup(),
|
scanner.async_setup(),
|
||||||
]
|
]
|
||||||
await cli.subscribe_bluetooth_le_advertisements(scanner.async_on_advertisement)
|
await cli.subscribe_bluetooth_le_advertisements(scanner.async_on_advertisement)
|
||||||
if connectable:
|
|
||||||
await cli.subscribe_bluetooth_connections_free(
|
|
||||||
entry_data.async_update_ble_connection_limits
|
|
||||||
)
|
|
||||||
|
|
||||||
@hass_callback
|
@hass_callback
|
||||||
def _async_unload() -> None:
|
def _async_unload() -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user