From 6c10d48a71c31cc72cfd3d339fd245470b87777b Mon Sep 17 00:00:00 2001 From: "Ian C." <108159253+ic-dev21@users.noreply.github.com> Date: Sat, 5 Sep 2026 13:33:29 -0400 Subject: [PATCH] Closing websocket subscription on unload This fixes #575 --- custom_components/hilo/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/custom_components/hilo/__init__.py b/custom_components/hilo/__init__.py index 9ec483a1..0e4d4ff2 100644 --- a/custom_components/hilo/__init__.py +++ b/custom_components/hilo/__init__.py @@ -326,6 +326,14 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: except asyncio.CancelledError: pass + for task in list(hilo.subscriptions): + if task and not task.done(): + task.cancel() + try: + await task + except asyncio.CancelledError: + pass + try: await hilo._api.signalr_devices.disconnect() except Exception as err: