Beremiz_service.py
changeset 2654 7575050a80c5
parent 2649 db68cb0e6bdc
child 2659 09bac1f52b1e
--- a/Beremiz_service.py	Thu May 28 11:15:22 2020 +0100
+++ b/Beremiz_service.py	Mon Jun 01 08:54:26 2020 +0100
@@ -476,6 +476,7 @@
 installThreadExcepthook()
 havewamp = False
 haveBNconf = False
+haveMBconf = False
 
 
 if havetwisted:
@@ -495,7 +496,16 @@
             haveBNconf = True
         except Exception:
             LogMessageAndException(_("BACnet configuration web interface - import failed :"))
-        
+
+    # Try to add support for Modbus configuration via web server interface
+    # NOTE:Modbus web config only makes sense if web server is available
+    if webport is not None:
+        try:
+            import runtime.Modbus_config as MBconf
+            haveMBconf = True
+        except Exception:
+            LogMessageAndException(_("Modbus configuration web interface - import failed :"))
+                
     try:
         import runtime.WampClient as WC  # pylint: disable=ungrouped-imports
         WC.WorkingDir = WorkingDir
@@ -540,6 +550,12 @@
         except Exception:
             LogMessageAndException(_("BACnet web configuration failed startup. "))
 
+    if haveMBconf:
+        try:
+            MBconf.init(plcobj, NS, WorkingDir)
+        except Exception:
+            LogMessageAndException(_("Modbus web configuration failed startup. "))
+
     if havewamp:
         try:
             WC.SetServer(pyroserver)