From d89d705b768a0bac28f0a3c67f6d79015f5c9259 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Mon, 15 Jul 2019 15:24:23 +0200 Subject: [PATCH] config switch for modbus debugging --- src/CommunicationProcessor.py | 5 ++++- src/Config.py | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/CommunicationProcessor.py b/src/CommunicationProcessor.py index afdf6f1..8c10295 100644 --- a/src/CommunicationProcessor.py +++ b/src/CommunicationProcessor.py @@ -20,7 +20,10 @@ class CommunicationProcessor(threading.Thread): wiringpi.wiringPiSetup() wiringpi.pinMode(ERROR_PIN, wiringpi.OUTPUT) self.daemon = True - logging.getLogger('pymodbus').setLevel(logging.ERROR) + if self.config.modbusDebug: + logging.getLogger('pymodbus').setLevel(logging.DEBUG) + else: + logging.getLogger('pymodbus').setLevel(logging.ERROR) self.logger = logging.getLogger('CommunicationProcessor') def __getSerial(self): diff --git a/src/Config.py b/src/Config.py index 5d7856e..f1258c0 100644 --- a/src/Config.py +++ b/src/Config.py @@ -2,6 +2,7 @@ class Config(object): def __init__(self): self.logFile = '/tmp/mbm.log' + self.modbusDebug = False self.mqttBrokerHost = '172.16.2.16' self.mqttBrokerPort = 1883 self.mqttLogin = ''