diff -r 769fefae7c81 -r 449c9539887a Beremiz_service.py --- a/Beremiz_service.py Wed Dec 18 13:31:22 2019 +0100 +++ b/Beremiz_service.py Thu May 28 11:16:59 2020 +0100 @@ -492,6 +492,8 @@ installThreadExcepthook() havewamp = False +haveBNconf = False + if havetwisted: if webport is not None: @@ -500,8 +502,17 @@ except Exception: LogMessageAndException(_("Nevow/Athena import failed :")) webport = None - NS.WorkingDir = WorkingDir - + NS.WorkingDir = WorkingDir # bug? what happens if import fails? + + # Try to add support for BACnet configuration via web server interface + # NOTE:BACnet web config only makes sense if web server is available + if webport is not None: + try: + import runtime.BACnet_config as BNconf + haveBNconf = True + except Exception: + LogMessageAndException(_("BACnet configuration web interface - import failed :")) + try: import runtime.WampClient as WC # pylint: disable=ungrouped-imports WC.WorkingDir = WorkingDir @@ -523,6 +534,8 @@ runtime.CreatePLCObjectSingleton( WorkingDir, argv, statuschange, evaluator, pyruntimevars) +plcobj = runtime.GetPLCObjectSingleton() + pyroserver = PyroServer(servicename, interface, port) if havewx: @@ -538,6 +551,12 @@ except Exception: LogMessageAndException(_("Nevow Web service failed. ")) + if haveBNconf: + try: + BNconf.init(plcobj, NS, WorkingDir) + except Exception: + LogMessageAndException(_("BACnet web configuration failed startup. ")) + if havewamp: try: WC.SetServer(pyroserver) @@ -601,7 +620,6 @@ pyroserver.Quit() pyro_thread.join() -plcobj = runtime.GetPLCObjectSingleton() plcobj.StopPLC() plcobj.UnLoadPLC()