mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 13:57:10 +00:00
Async fix for bluetooth stopping (#23225)
This commit is contained in:
parent
bea7e2a7fa
commit
dbe0ba87a3
@ -24,7 +24,7 @@ def setup_scanner(hass, config, see, discovery_info=None):
|
|||||||
new_devices = {}
|
new_devices = {}
|
||||||
hass.data.setdefault(DATA_BLE, {DATA_BLE_ADAPTER: None})
|
hass.data.setdefault(DATA_BLE, {DATA_BLE_ADAPTER: None})
|
||||||
|
|
||||||
async def async_stop(event):
|
def handle_stop(event):
|
||||||
"""Try to shut down the bluetooth child process nicely."""
|
"""Try to shut down the bluetooth child process nicely."""
|
||||||
# These should never be unset at the point this runs, but just for
|
# These should never be unset at the point this runs, but just for
|
||||||
# safety's sake, use `get`.
|
# safety's sake, use `get`.
|
||||||
@ -32,7 +32,7 @@ def setup_scanner(hass, config, see, discovery_info=None):
|
|||||||
if adapter is not None:
|
if adapter is not None:
|
||||||
adapter.kill()
|
adapter.kill()
|
||||||
|
|
||||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, async_stop)
|
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, handle_stop)
|
||||||
|
|
||||||
def see_device(address, name, new_device=False):
|
def see_device(address, name, new_device=False):
|
||||||
"""Mark a device as seen."""
|
"""Mark a device as seen."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user