config switch for modbus debugging

This commit is contained in:
Wolfgang Hottgenroth 2019-07-15 15:24:23 +02:00
parent 9f6f449c5a
commit d89d705b76
Signed by: wn
GPG Key ID: 6C1E5E531E0D5D7F
2 changed files with 5 additions and 1 deletions

View File

@ -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):

View File

@ -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 = ''