Hi,
I'm trying to create an RTU server using Modbus-TK. For testing purposes, I want to imitate several real MODBUS devices on a raspberry Pi using Modbus-TK. I want to connect the raspberry Pi to an existing MODBUS network, which will have multiple MODBUS slaves on it.
I am able to get a server running using the example, and I was even able to get a couple of hooks set up, but it appears that the server fails when it receives a slave ID that is not one of it's own? I'm hooking up the raspberry Pi to a MODBUS network with multiple other devices on it, so there is quite a bit of traffic going across the network for many different slave IDs. I have the Modbus-tk server set up with Slave ID #10, but it throws an error for Slave ID #1 (which is for a different device).
You can see the error I'm getting below:
sudo python3 server.py
RtuServer /dev/ttyUSB0 is opened
running...
enter 'quit' for closing the server
After Read bytearray(b'\x01\x03\x00\x00\x00\x02\xc4\x0b')handle request failed: Slave 1 doesn't exist
Before Write b'\x83\x04'
After Write b'\x83\x04'
After Read bytearray(b'\x01\x03\x04\x00\xe4\x01F:f')handle request failed: Slave 1 doesn't exist
How can I set up an RTU MODBUS server to only respond to messages that are for the slave IDs that it owns?
Thanks!