This commit is contained in:
Wolfgang Hottgenroth 2019-07-08 19:50:37 +01:00
parent 9bdd889bc4
commit 22b8ee6404
3 changed files with 3 additions and 3 deletions

View File

@ -9,7 +9,7 @@ client.socket = ser
client.connect()
try:
result = client.write_register(address=0x9c47, unit=4, value=0x8000)
result = client.write_register(address=0x9c48, unit=4, value=0x000F)
# result = client.write_coil(address=0x0000, unit=4, value=1)
print(result)
except Exception as e:

View File

@ -61,13 +61,13 @@ class HoldingRegisterDatapoint(AbstractModbusDatapoint):
self.writeRequestValue = None
else:
# perform read operation
print("Holding register, perform read operation")
# print("Holding register, perform read operation")
result = client.read_holding_registers(address=self.address,
count=self.count,
unit=self.unit)
if type(result) in [ExceptionResponse, ModbusIOException]:
raise DatapointException(result)
print("{0}: {1!s}".format(self.label, result.registers))
# print("{0}: {1!s}".format(self.label, result.registers))
pubQueue.put(MqttProcessor.PublishItem(self.publishTopic, str(result.registers)))
if successFull:
self.lastContact = datetime.datetime.now()

Binary file not shown.