Something went wrong. Try again.
lol
Something went wrong. Try again.
979 B · 28 lines
at master
1234567891011121314151617181920212223242526272829diff --git a/motionblindsble/device.py b/motionblindsble/device.pyindex 9c6ecf9..0d9affc 100644--- a/motionblindsble/device.py+++ b/motionblindsble/device.py@@ -11,6 +11,8 @@ from asyncio import ( TimerHandle, create_task, get_event_loop,+ new_event_loop,+ set_event_loop, sleep, wait, )@@ -248,7 +250,13 @@ class ConnectionQueue: ) return device._create_task(target=device.establish_connection()) _LOGGER.debug("(%s) Connecting", device.ble_device.address)- return get_event_loop().create_task(device.establish_connection())+ try:+ loop = get_event_loop()+ except RuntimeError:+ loop = new_event_loop()+ set_event_loop(loop)++ return loop.create_task(device.establish_connection()) async def wait_for_connection(self, device: MotionDevice) -> bool: """Wait for a connection, return True to last caller if connected."""