write stuff

This commit is contained in:
Wolfgang Hottgenroth 2019-07-16 17:11:53 +01:00
parent de01ec20e2
commit 34ca87f734
2 changed files with 13 additions and 39 deletions

View File

@ -70,10 +70,10 @@ class HoldingRegisterDatapoint(AbstractModbusDatapoint):
logger.debug("Holding register, perform write operation") logger.debug("Holding register, perform write operation")
self.processCount += 1 self.processCount += 1
v = int(self.writeRequestValue) v = int(self.writeRequestValue)
result = client.write_register(address=self.address, result = client.write_registers(address=self.address,
unit=self.unit, unit=self.unit,
value=v) values=[v])
logger.debug("Write result: {0!s".format(result)) logger.debug("Write result: {0!s}".format(result))
self.writeRequestValue = None self.writeRequestValue = None
else: else:
# perform read operation # perform read operation

View File

@ -5,7 +5,7 @@
"count": 1, "count": 1,
"label": "Temperature", "label": "Temperature",
"publishTopic": "Pub/Temperature", "publishTopic": "Pub/Temperature",
"scanRate": 60.0, "scanRate": null,
"unit": 5, "unit": 5,
"updateOnly": false "updateOnly": false
}, },
@ -29,7 +29,7 @@
"count": 1, "count": 1,
"label": "Switches", "label": "Switches",
"publishTopic": "Pub/Switches", "publishTopic": "Pub/Switches",
"scanRate": 0.25, "scanRate": null,
"unit": 4, "unit": 4,
"updateOnly": false "updateOnly": false
}, },
@ -42,7 +42,7 @@
"feedbackTopic": null, "feedbackTopic": null,
"label": "Counter1", "label": "Counter1",
"publishTopic": "Pub/Counter1", "publishTopic": "Pub/Counter1",
"scanRate": 1.0, "scanRate": null,
"subscribeTopic": null, "subscribeTopic": null,
"unit": 4 "unit": 4
}, },
@ -55,7 +55,7 @@
"feedbackTopic": null, "feedbackTopic": null,
"label": "Counter2", "label": "Counter2",
"publishTopic": "Pub/Counter2", "publishTopic": "Pub/Counter2",
"scanRate": 1.0, "scanRate": null,
"subscribeTopic": null, "subscribeTopic": null,
"unit": 4 "unit": 4
}, },
@ -68,7 +68,7 @@
"feedbackTopic": null, "feedbackTopic": null,
"label": "Counter3", "label": "Counter3",
"publishTopic": "Pub/Counter3", "publishTopic": "Pub/Counter3",
"scanRate": 1.0, "scanRate": null,
"subscribeTopic": null, "subscribeTopic": null,
"unit": 4 "unit": 4
}, },
@ -89,39 +89,13 @@
}, },
{ {
"args": { "args": {
"address": 40001, "address": 40016,
"count": 1, "count": 2,
"feedbackTopic": null, "feedbackTopic": "FB/Counter4",
"label": "Version", "label": "Counter4_W",
"publishTopic": "Pub/Version",
"scanRate": 1.0,
"subscribeTopic": null,
"unit": 4
},
"type": "HoldingRegisterDatapoint"
},
{
"args": {
"address": 40001,
"count": 1,
"feedbackTopic": null,
"label": "Version",
"publishTopic": "Pub/Version",
"scanRate": 10.0,
"subscribeTopic": null,
"unit": 4
},
"type": "HoldingRegisterDatapoint"
},
{
"args": {
"address": 40001,
"count": 1,
"feedbackTopic": "FB/Version",
"label": "Version_W",
"publishTopic": null, "publishTopic": null,
"scanRate": 0.0, "scanRate": 0.0,
"subscribeTopic": "Sub/Version", "subscribeTopic": "Sub/Counter4",
"unit": 4 "unit": 4
}, },
"type": "HoldingRegisterDatapoint" "type": "HoldingRegisterDatapoint"