This commit is contained in:
2019-07-08 16:33:37 +02:00
parent 80a8304986
commit 55344b158b

View File

@ -83,20 +83,24 @@ class HoldingRegisterDatapoint(AbstractModbusDatapoint):
self.writeRequestValue = value
class InputRegisterDatapoint(AbstractModbusDatapoint):
class ReadOnlyDatapoint(AbstractModbusDatapoint):
def __init__(self, label, unit, address, count, scanRate, updateOnly, publishTopic):
super().__init__(label, unit, address, count, scanRate)
self.updateOnly = updateOnly
self.lastValue = None
self.publishTopic = publishTopic
self.lastContact = None
self.type = 'input register'
def __str__(self):
return "[{0!s}, UpdateOnly: {1}, Read: {2}".format(super().__str__(), self.updateOnly, self.publishTopic)
class InputRegisterDatapoint(ReadOnlyDatapoint):
def __init__(self, label, unit, address, count, scanRate, updateOnly, publishTopic):
super().__init__(label, unit, address, count, scanRate, updateOnly, publishTopic)
self.type = 'input register'
def process(self, client, pubQueue):
successFull = True
giveUp = False
@ -123,18 +127,11 @@ class InputRegisterDatapoint(AbstractModbusDatapoint):
pass
class DiscreteInputDatapoint(AbstractModbusDatapoint):
class DiscreteInputDatapoint(ReadOnlyDatapoint):
def __init__(self, label, unit, address, count, scanRate, updateOnly, publishTopic):
super().__init__(label, unit, address, count, scanRate)
self.updateOnly = updateOnly
self.lastValue = None
self.publishTopic = publishTopic
self.lastContact = None
super().__init__(label, unit, address, count, scanRate, updateOnly, publishTopic)
self.type = 'discrete input'
def __str__(self):
return "[{0!s}, UpdateOnly: {1}, Read: {2}".format(super().__str__(), self.updateOnly, self.publishTopic)
def process(self, client, pubQueue):
successFull = True
giveUp = False