fix
This commit is contained in:
parent
d3b7fcaecd
commit
58bc7c0477
@ -23,7 +23,7 @@ class ArchiveSynchronizer(Component):
|
|||||||
def __init__(self, config=None, name=None, period=1, lazy=True, paused=False, threaded=True):
|
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)
|
super().__init__(config=config, name=name, period=period, lazy=lazy, paused=paused, threaded=threaded)
|
||||||
self.simulate = "--sim-archiver" in sys.argv
|
self.simulate = "--sim-archiver" in sys.argv
|
||||||
self.machine_status = "offline"
|
#self.machine_status = "offline"
|
||||||
|
|
||||||
def config_changed(self):
|
def config_changed(self):
|
||||||
self.machine_id = self.config.machine_id
|
self.machine_id = self.config.machine_id
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
import warnings
|
||||||
|
|
||||||
if "--sim-serial" in sys.argv:
|
if "--sim-serial" in sys.argv:
|
||||||
from components.dummies.serial import serial
|
from components.dummies.serial import serial
|
||||||
@ -48,7 +49,10 @@ class ModbusComponent(Component):
|
|||||||
strict=False,
|
strict=False,
|
||||||
)
|
)
|
||||||
if not self.client.connect():
|
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))
|
raise ConnectionError("device not reachable (could not connect): {} ({})".format(self.name, self.port))
|
||||||
|
|
||||||
if not self.client.is_socket_open():
|
if not self.client.is_socket_open():
|
||||||
raise ConnectionError("device not reachable (socket not open): {} ({})".format(self.name, self.port))
|
raise ConnectionError("device not reachable (socket not open): {} ({})".format(self.name, self.port))
|
||||||
self.lock.unlock()
|
self.lock.unlock()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user