Modbus errors

Tags: #<Tag:0x00007fc8f2d17820>

I have alot of this errors in my log. Would it be possible to give a Waring when it retries and Error when al retries fails?

2021-01-18 11:20:47.094 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 1/5 error: connect timed out. Connection TCPMasterConnection@e533c0[socket=Socket[unconnected]]. Endpoint ModbusTCPSlaveEndpoint@1d6b7db[address=192.168.192.68,port=502]
2021-01-18 11:21:43.347 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 1/5 error: connect timed out. Connection TCPMasterConnection@7a5fca[socket=Socket[unconnected]]. Endpoint ModbusTCPSlaveEndpoint@1d6b7db[address=192.168.192.68,port=502]
2021-01-18 11:22:50.964 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 1/5 error: connect timed out. Connection TCPMasterConnection@a4de66[socket=Socket[unconnected]]. Endpoint ModbusTCPSlaveEndpoint@1d6b7db[address=192.168.192.68,port=502]

@ssalonen Do you have any input on this?

off-topic ; you could try fixing the underlying error by use of timeBetweenReconnectMillis parameter

I can not se how this parameters should change that it is timing out on the first try?

We don’t know why it times out on the first try, but it might be because the remote end is still tidying up the old connection and will not yet accept a new connection. It might work better if you allow more time between a disconnect and reconnect.

I am just pulling every 60 sec.

Alright, we’ve seen devices before that do not disconnect cleanly with the default binding settings. Try increasing reconnectAfterMillis to an hour or so.

Good suggestion adjusting logging.

Would you like make a PR?

openhab-core/ModbusSlaveConnectionFactoryImpl.java at main · openhab/openhab-core · GitHub line 322

I will look into if i can do a PR :slight_smile:

1 Like

If i use reconnectAfterMillis it does not reconnect and i get to much updates.

You are always using reconnectAfterMillis whether you set it to something non-default or not, it exists and is used.

If you want some help with that, please say what you are doing and what ‘too much updates’ means.

1 Like

PR done.
Can you check it i missed something.

1 Like