Skip to content

Commit 7eb1923

Browse files
committed
Catching errors during stop scanning
1 parent 73e240a commit 7eb1923

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

custom_components/ble_monitor/__init__.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -326,14 +326,17 @@ def run(self):
326326
try:
327327
self._event_loop.run_until_complete(btctrl[hci].send_scan_request(self._active))
328328
except RuntimeError as error:
329-
_LOGGER.error("HCIdump thread: Runtime error while sending scan request: %s", error)
329+
_LOGGER.error("HCIdump thread: Runtime error while sending scan request on hci%i: %s", hci, error)
330330
_LOGGER.debug("HCIdump thread: start main event_loop")
331331
try:
332332
self._event_loop.run_forever()
333333
finally:
334334
_LOGGER.debug("HCIdump thread: main event_loop stopped, finishing")
335335
for hci in self._interfaces:
336-
self._event_loop.run_until_complete(btctrl[hci].stop_scan_request())
336+
try:
337+
self._event_loop.run_until_complete(btctrl[hci].stop_scan_request())
338+
except RuntimeError as error:
339+
_LOGGER.error("HCIdump thread: Runtime error while stop scan request on hci%i: %s", hci, error)
337340
conn[hci].close()
338341
self._event_loop.run_until_complete(asyncio.sleep(0))
339342
if self._joining is True:

0 commit comments

Comments
 (0)