Can anyone explain how to create the request and get the response in right way using pymodbus via Modbus TCP/IP?
I have the PLC which I want to use as slave and PC - as master.
I trying to do it in such way:
from pymodbus.client.sync import ModbusTcpClient
host = '192.168.56.9'
port = 502
client = ModbusTcpClient(host, port)
client.connect()
#Register address 0x102A (4138dec) with a word count of 1
#Value - MODBUS/TCP Connections
#Access - Read
#Description - Number of TCP connections
request = client.read_holding_registers(4138, 1)
response = client.execute(request)
print response
>>> ReadRegisterResponse (1)