Any battle-tested ModBus/TCP library out there with proper network error resilience

Before I go bananas and refactor some old ModBus library I just want to ask if there are any well working and battle tested modbus over tcp libraries out there with (and this is important) well designed error handling for both protocol and network related errors?

I am currently using Alex’s implementation at https://gitlab.com/heyoka/erlang-modbus but error handling is not working sufficient for my needs.

I desperately need a library that deals well with real world network errors, it just can’t crash when a switch updates at 3:am. Also it has to log errors properly.

I have evaluated all libraries I have found and they tent to be forks of 3 different libraries or so. I think the only one realistic is the one from Heyoka/Alex and still I am not satisfied.

Before I spend time on building YAML (yet another modbus library, could be a confusing name though) I just thought I should ask… A lot of fun things to do, so little time.

Why I think this is important
ModBus over TCP is a protocol used to control real live equipment. I currently use ModBus/TCP to regulate heating in our expensive battery pack that is housed with some distance from out heated buildings due to insurance rules. Thus I need heat regulation - it is cold here in Sweden this period of the year.
When the ModBus library fails to handle network errors properly but instead crashes the application, heating fails and there are real risks of property damages; batteries does not deal with cold so well. I plan to regulate the entire solar facility which must be done properly, there are real life damages at stake here.

Meanwhile networking is not a straight forward thing to build and it must have nuanced error handling. Some errors like network disconnect shall reconnect after a while. Other errors, like DNS lookup failure is more permanent errors and shall be treated differently.

This is an area where what we call errors not really are errors (like in crash the process when an error occurs), but rather natural states of a real life network connection. It is part of networking and shall be treated as such.

Same goes for protocol errors. If I have a malformed Modbus command, it won’t work better if I sent it 5 times, instead there is a bug in the protocol implementation (or the other sides implementation), or a misconfiguration.

Well, ranting aside, if you have experience using Modbus I like to hear about it and what library you have been using.

Thanks,
Erik