Why does the Modbus binding kill OH2 on timeout?

I’ve been using OH2 for quite a while, and only after setting up some watchdog monitors did I realize this has been going on the whole time.

Long story short, When the modbus binding errors out, as in the device it’s set to poll doesn’t respond, all other bindings give up on updating. Even the OH2 API stops working, eg I can’t update item states with it.

I have the modbus binding set to poll a PLC slave over TCP with 20 or 30 items/registers. Works perfectly fine. I also have the SNMP and MQTT binding, as well as Node-Red updating some items with the OH2 node-red plugin (which just uses the OH2 REST API). After setting up some watchdog timers externally that notify me when OH2 items stop being updated, I realized that every time the PLC went offline, (as in I just unplug it), ALL bindings completely stop updating. Even items that get updated via node-red via the rest API stop getting updated. When I plug the PLC back in and the modbus binding can succesfully reach it, all the bindings start working again. I’m looking right at /var/log/openhab2/events.log and all items just go completely dead when this happens until I plug the PLC back in.

This isn’t expected behavior is it? After testing, if I disconnect SNMP devices to error out the SNMP binding, other bindings still keep chugging along as expected. Is this a bug? I’m on snapshot branch on linux on a box with plenty of resources, it seems this has been happening for months

It is not expected and definitely worth filling an issue. I’m not 100% certain the correct place but since the Modbus binding seems to be the source of the problem I would start there. But it could be a structural problem because the binding shouldn’t be able stop everything like that.

On a separate note. Would you be willing to write up a little tutorial on how you set up the watchdogs? I think many in the community would like to do the same and you have already proven it’s use in debugging problems like this.

Any particular place I should file an official issue? I’m guessing just the OH2 github? I do agree it’s strange a single binding can completely cripple an OH2 install. I also just noticed something interesting, the longer the device is gone and the modbus binding is failing to poll it, the longer OH2 takes to recover after plugging it back in. Just unplugged the plc for an hour or so to do some work and when I plugged it back in, it took OH2 so long to start polling mqtt again i gave up and just restarted the service.

maybe the talented @ssalonen has some input? this is version “binding-modbus1 - 1.11.0.SNAPSHOT” on OH2

Also Rich I’d be willing to write a short tutorial but it’s not super complex, just using a separate node-red instance to watch for item changes and then sending an SMS via Twilio if a failure occurs

I would start with the openhab-addons repo and tag it with mobus. If the devs decide the issue is wider in scope it will probably need to be filled on ESH repo.

It doesn’t have to be completely to be useful. It would be more useful if it where more generic (i.e. didn’t require node red) but still write useful to the community as is.

1 Like

This is quite something! Perhaps you can open the issue and post verbose logs there.


1 Like