This commit is contained in:
Eduardo 2024-10-28 15:58:46 +01:00
parent d3b7fcaecd
commit 58bc7c0477
2 changed files with 5 additions and 1 deletions

View File

@ -23,7 +23,7 @@ class ArchiveSynchronizer(Component):
def __init__(self, config=None, name=None, period=1, lazy=True, paused=False, threaded=True):
super().__init__(config=config, name=name, period=period, lazy=lazy, paused=paused, threaded=threaded)
self.simulate = "--sim-archiver" in sys.argv
self.machine_status = "offline"
#self.machine_status = "offline"
def config_changed(self):
self.machine_id = self.config.machine_id

View File

@ -1,5 +1,6 @@
import sys
import traceback
import warnings
if "--sim-serial" in sys.argv:
from components.dummies.serial import serial
@ -48,7 +49,10 @@ class ModbusComponent(Component):
strict=False,
)
if not self.client.connect():
warnings.warn("device not reachable (could not connect): {} ({})".format(self.name, self.port),
RuntimeWarning)
raise ConnectionError("device not reachable (could not connect): {} ({})".format(self.name, self.port))
if not self.client.is_socket_open():
raise ConnectionError("device not reachable (socket not open): {} ({})".format(self.name, self.port))
self.lock.unlock()