Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Modbus binding (in serial mode) does not handle Modbus Exception Responses in any way #3546

Closed
mbs38 opened this issue Dec 14, 2015 · 7 comments

Comments

@mbs38
Copy link
Contributor

mbs38 commented Dec 14, 2015

Seems to apply to serial mode only.

A standard Modbus Exception Response (as outlined here: http://www.simplymodbus.ca/exceptions.htm) sent by a Modbus device is not recognized by the binding. Instead, these responses are deemed inclompete and an IOException "Error reading response" is thrown. This leaves the user with no way of knowing whether there is a real problem or if he/she has just tried to, for example, access a non existent register/coil/input on the Modbus device.

@ssalonen
Copy link
Contributor

You are right that error messages are not quite self-explanatory. I have actually worked on improved error messages in my branch -- it's must-have to have better error messages even during developmnet. In my branch you can see the exact error code as WARN level (as referenced in in the page you linked).

I have been also thinking that different exception should be handled in a different way. In the current implementaion all kind of exceptions (even recognized modbus exceptions) are handled the same way -- connection is reseted. This is completely unnecessarily. The new branch introduces error handling that point out the root cause: modbus error or IO error or transaction id mismatch.

I would like to get any feedback for the changes! Is warn level too high for modbus errors, or should we stick with debug level?

@mbs38
Copy link
Contributor Author

mbs38 commented Dec 26, 2015

Classic timeout (the Modbus device does not respond within the set time limit) is certainly worth to be a warn level error. Otherwise a Modbus device could disappear unnoticed - that's not good.
However, if the user is trying to do things the given Modbus device does not support it would probably be a lot more user friendly to throw a warn level error as well. Something that points into the direction "yes your device responds correctly but you are trying to do something it doesn't support"

@ssalonen
Copy link
Contributor

ssalonen commented Jun 8, 2016

PR #4226 (which is now merged) should improve logging a lot. Can you try with the new version?

@mbs38
Copy link
Contributor Author

mbs38 commented Jun 9, 2016

Unfortunately my studies+exams take up all my time atm. I'll do some checks in a couple of weeks. Btw I've just moved my rather big modbus serial installation to openhab 2 and it's running well at 2600/polls a minute with 17 devices on the bus.

@9037568
Copy link
Contributor

9037568 commented Dec 17, 2016

Hopefully fixed via PR #4226. Please start a new issue if additional problems are found.

@9037568 9037568 closed this as completed Dec 17, 2016
@mbs38
Copy link
Contributor Author

mbs38 commented Dec 18, 2016

I'm sorry - I've completely forgotten this issue. Unfortunately it has not been fixed by PR #4226.

@ssalonen
Copy link
Contributor

Thanks . What is the behavior exactly currently with latest development version?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants