From 517e88600c9b7a49d2baca2a11ece1fa2dcda7ee Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 17 Feb 2023 14:52:30 -0500 Subject: [PATCH] Fix dangling task for mysensors (#88290) Co-authored-by: Martin Hjelmare --- homeassistant/components/mysensors/gateway.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/mysensors/gateway.py b/homeassistant/components/mysensors/gateway.py index 635df264f75..1d016a791e3 100644 --- a/homeassistant/components/mysensors/gateway.py +++ b/homeassistant/components/mysensors/gateway.py @@ -116,7 +116,7 @@ async def try_connect( finally: if connect_task is not None and not connect_task.done(): connect_task.cancel() - asyncio.create_task(gateway.stop()) + await gateway.stop() except OSError as err: _LOGGER.info("Try gateway connect failed with exception", exc_info=err) return False