diff --git a/packages/modules/devices/algodue/algodue/counter.py b/packages/modules/devices/algodue/algodue/counter.py index 20717c8f89..3f432a816a 100644 --- a/packages/modules/devices/algodue/algodue/counter.py +++ b/packages/modules/devices/algodue/algodue/counter.py @@ -24,7 +24,6 @@ def __init__(self, component_config: AlgodueCounterSetup, **kwargs: Any) -> None self.kwargs: KwargsDict = kwargs def initialize(self) -> None: - # return self.__device_id: int = self.kwargs['device_id'] self.__tcp_client: modbus.ModbusTcpClient_ = self.kwargs['tcp_client'] self.__modbus_id: int = self.kwargs['modbus_id'] diff --git a/packages/modules/devices/algodue/algodue/device.py b/packages/modules/devices/algodue/algodue/device.py index ce0fb35def..8b3ff704b6 100644 --- a/packages/modules/devices/algodue/algodue/device.py +++ b/packages/modules/devices/algodue/algodue/device.py @@ -26,12 +26,13 @@ def update_components(components: Iterable[counter.AlgodueCounter]): with SingleComponentUpdateContext(component.fault_state): component.update() - try: + def initializer(): + nonlocal client client = modbus.ModbusTcpClient_(device_config.configuration.ip_address, device_config.configuration.port) - except Exception: - log.exception("Fehler in create_device") + return ConfigurableDevice( device_config=device_config, + initializer=initializer, component_factory=ComponentFactoryByType( counter=create_counter_component ),