I am trying send the query and get the response message (data) through modbus using python with the help of pymodbus module.
response=client.read_holding_registers(19200,126,unit=135)
print(response)
The response that is being printed is the request message sent and the process status. I am interested in reading the data sent from the slave and not the process status. Can you please help me with this?
You should use the .registers
Try the following procedure:
response = client.read_holding_registers(19200, 126, unit=135)
if not response.isError():
print(response.registers)
else:
# Handle Error
[NOTE]:
.isError()
method is for pymodbus 1.4.0 and above.
来源:https://stackoverflow.com/questions/52773545/reading-response-message-in-modbus-using-python