diff --git a/src/pydase/components/device_connection.py b/src/pydase/components/device_connection.py index cf98a62..b7b648c 100644 --- a/src/pydase/components/device_connection.py +++ b/src/pydase/components/device_connection.py @@ -1,6 +1,7 @@ import asyncio import pydase.data_service +import pydase.task class DeviceConnection(pydase.data_service.DataService): @@ -52,7 +53,6 @@ class DeviceConnection(pydase.data_service.DataService): def __init__(self) -> None: super().__init__() self._connected = False - self._autostart_tasks["_handle_connection"] = () # type: ignore self._reconnection_wait_time = 10.0 def connect(self) -> None: @@ -70,6 +70,7 @@ class DeviceConnection(pydase.data_service.DataService): """ return self._connected + @pydase.task.task(autostart=True) async def _handle_connection(self) -> None: """Automatically tries reconnecting to the device if it is not connected. This method leverages the `connect` method and the `connected` property to