diff --git a/src/RegisterDatapoint.py b/src/RegisterDatapoint.py index a930ed4..80cddc4 100644 --- a/src/RegisterDatapoint.py +++ b/src/RegisterDatapoint.py @@ -3,6 +3,7 @@ from pymodbus.pdu import ExceptionResponse from pymodbus.exceptions import ModbusIOException import MqttProcessor import logging +import pickle class DatapointException(Exception): pass @@ -142,7 +143,7 @@ def loadRegisterList(registerList): with open(registerList, 'rb') as f: datapoints = pickle.load(f) - RegisterDatapoint.checkRegisterList(datapoints, reset=True) + checkRegisterList(datapoints) newDatapoints = [] for dp in datapoints: @@ -152,11 +153,13 @@ def loadRegisterList(registerList): newDatapoints.append(ndp) logging.getLogger('loadRegisterList').debug("Datapoint loaded: {0!s}".format(ndp)) - RegisterDatapoint.checkRegisterList(newDatapoints, reset=True) + checkRegisterList(newDatapoints, reset=True) with open(registerList, 'wb') as f: pickle.dump(newDatapoints, f) + return newDatapoints + def checkRegisterList(registers, reset=False): for r in registers: diff --git a/src/registers.pkl b/src/registers.pkl index 7fd2742..111ad46 100644 Binary files a/src/registers.pkl and b/src/registers.pkl differ