Solution for Python Modbus How to access multiple slave data
is Given Below:
I would like to ask your masters for help.
We communicate with equipment with modbus, but only if the master and slave are 1:1 for the pymodbs.
The problem is that one master wants to manage several slaves.
To do so, we have to use slave_id, which is impossible in the pymodbs, and we found that umodbus is possible.
def get_serial_port(): """ Return serial.Serial instance, ready to use for RS485.""" port = Serial(port="/dev/ttyS1", baudrate=9600, parity=PARITY_NONE, stopbits=1, bytesize=8, timeout=1) fh = port.fileno() # A struct with configuration for serial port. serial_rs485 = struct.pack('hhhhhhhh', 1, 0, 0, 0, 0, 0, 0, 0) fcntl.ioctl(fh, 0x542F, serial_rs485) return port serial_port = get_serial_port()
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 8, in get_serial_port OSError: [Errno 25] Inappropriate ioctl for device
The problem is that the error is occurring at 0x542F in the process of acquiring the port from umodbus.
How can we solve the problem?
And is it possible to communicate in the pymodbus at 1:m?