-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Hi. I would like to report that I have found an use case where the library does not conform to modbus protocol.
Trying to reach invalid addresses should return an exception code 0x02 as per the protocol. The pymodbus library conveniently has a way to label some addresses as invalid in the setup.json file, but this functionality has been a bit broken since the change from 3.9.0.
Steps to reproduce:
- clone this simple repo that I made to illustrate the issue.
- install version 3.8.6 of pymodbus
- execute
python simulator.py - execute
python client.py 0 - execute
python client.py 4 - Now install version 3.9.0 of pymodbus
- repeat steps 3 through 5
The setup.json in this file has only 4 memory locations where addresses 0 and 1 are invalid and addresses higher than 3 do not exist. Observe that with version 3.8.6, accessing address 0 makes the server print the correct function code (131) with the correct exception code (2), because 0 is marked as invalid in setup.json. Still, accessing address 4 should have made the server print the same values as the case with address 0 since it is invalid because its out of range. Instead, the server builds a 0x00 exception response with SLAVE_FAILURE exception code. which the client understands as IO failiure instead of a normal exception. Now, with version 3.9.0, the case with address 0 returns no issue, and the problem with address 4 still exists.
I would really appreciate if you would let me know if I did anything wrong in my setup to cause these issues.