Modbus binding, problems with silently disconnected items

Hello,

I have recurring problems with the Modbus protocol. I use it to control my heating circuit (WAGO 750-842, self-programmed).
Every few days or weeks, the connection breaks down (often without the items going into error). If I restart the Modbus protocol, everything is fine again.

Can this be due to my configuration or can someone help me solve the problem?

Old configuration, problem occurred quite often:

Bridge modbus:tcp:wago_1 [ host="heizung.fritz.box", port=502, id=1, maxTries=10, refresh=5000 ]
{
    Bridge poller io [ start=12288, length=5, type="coil" ] 
    {
        Thing data steuerung_an     [ readStart="12288", readValueType="bit", writeStart="12288", writeValueType="bit", writeType="coil" ]
        Thing data heizkreis_eg_an  [ readStart="12289", readValueType="bit", writeStart="12289", writeValueType="bit", writeType="coil" ]
        Thing data regelung_eg_an   [ readStart="12290", readValueType="bit", writeStart="12290", writeValueType="bit", writeType="coil" ]
        Thing data heizkreis_og_an  [ readStart="12291", readValueType="bit", writeStart="12291", writeValueType="bit", writeType="coil" ]
        Thing data regelung_og_an   [ readStart="12292", readValueType="bit", writeStart="12292", writeValueType="bit", writeType="coil" ]
    } 
 
    Bridge poller outputs_digital [ start=512, length=8, type="coil", maxTries=10, refresh=5000 ] 
    {
        Thing data pumpe_og         [ readStart="512", readValueType="bit", writeStart="512", writeValueType="bit", writeType="coil" ]
        Thing data nachtabsenkung   [ readStart="514", readValueType="bit", writeStart="514", writeValueType="bit", writeType="coil" ]
        Thing data pumpe_eg         [ readStart="516", readValueType="bit", writeStart="516", writeValueType="bit", writeType="coil" ]
        Thing data da_not_used_06   [ readStart="518", readValueType="bit", writeStart="518", writeValueType="bit", writeType="coil" ]
    }
  
    Bridge poller inputs_digital [ start=0, length=8, type="coil", maxTries=10, refresh=5000  ] 
    {
        Thing data warmwasserladung    [ readStart="0", readValueType="bit" ]
        Thing data di_not_used_01      [ readStart="1", readValueType="bit" ]
        Thing data di_not_used_02      [ readStart="2", readValueType="bit" ]
        Thing data di_not_used_03      [ readStart="3", readValueType="bit" ]
    } 
 
    Bridge poller holdings [ start=12290, length=28, type="holding", maxTries=10, refresh=5000 ] 
    { 
        
        Thing data md_soll_vl_eg  [ readStart="12290", readValueType="int32_swap", readTransform="JS(divide10.js)",   writeStart="12290", writeValueType="int32_swap", writeType="holding", writeTransform="JS(multiply10.js)" ]   
        Thing data md_soll_vl_og  [ readStart="12292", readValueType="int32_swap", readTransform="JS(divide10.js)",   writeStart="12292", writeValueType="int32_swap", writeType="holding", writeTransform="JS(multiply10.js)" ]   
        Thing data md_stzyklus    [ readStart="12294", readValueType="int32_swap", readTransform="JS(divide1000.js)", writeStart="12294", writeValueType="int32_swap", writeType="holding", writeTransform="JS(multiply1000.js)" ]    
        Thing data md_stfaktor    [ readStart="12296", readValueType="int32_swap", readTransform="JS(divide1000.js)", writeStart="12296", writeValueType="int32_swap", writeType="holding", writeTransform="JS(multiply1000.js)"  ]
        Thing data md_sttoleranz  [ readStart="12298", readValueType="int32_swap", readTransform="JS(divide10.js)",   writeStart="12298", writeValueType="int32_swap", writeType="holding", writeTransform="JS(multiply10.js)" ]   
        //Thing data md_ist_vl_eg   [ readStart="12300", readValueType="int32_swap" ]
        //Thing data md_ist_vl_og   [ readStart="12302", readValueType="int32_swap" ] 
        Thing data md_stzeitmax   [ readStart="12304", readValueType="int32_swap", readTransform="JS(divide1000.js)", writeStart="12304", writeValueType="int32_swap", writeType="holding", writeTransform="JS(multiply1000.js)" ]    
        Thing data md_soll_tempog [ readStart="12306", readValueType="int32_swap", readTransform="JS(divide10.js)",   writeStart="12306", writeValueType="int32_swap", writeType="holding", writeTransform="JS(multiply10.js)" ]
        Thing data md_steilog     [ readStart="12308", readValueType="int32_swap", readTransform="JS(divide10.js)",   writeStart="12308", writeValueType="int32_swap", writeType="holding", writeTransform="JS(multiply10.js)" ]
        Thing data md_soll_tempeg [ readStart="12310", readValueType="int32_swap", readTransform="JS(divide10.js)",   writeStart="12310", writeValueType="int32_swap", writeType="holding", writeTransform="JS(multiply10.js)" ]
        Thing data md_steileg     [ readStart="12312", readValueType="int32_swap", readTransform="JS(divide10.js)",   writeStart="12312", writeValueType="int32_swap", writeType="holding", writeTransform="JS(multiply10.js)" ]
        Thing data md_aussentemp  [ readStart="12314", readValueType="int32_swap", readTransform="JS(divide10.js)",   writeStart="12314", writeValueType="int32_swap", writeType="holding", writeTransform="JS(multiply10.js)" ]
        Thing data md_stfaktor2   [ readStart="12316", readValueType="int32_swap", readTransform="JS(divide1000.js)", writeStart="12316", writeValueType="int32_swap", writeType="holding", writeTransform="JS(multiply1000.js)"  ]
    }
}

New configuration, problem seems to occur less frequently, but still too frequently.
I only changed a few timing settings, the rest is the same:

Bridge modbus:tcp:wago_1 [ host="heizung.fritz.box", port=502, id=1, connectMaxTries=10, reconnectAfterMillis=100]
{
    Bridge poller io [ start=12288, length=5, type="coil", refresh=5000 ] 
    {
        Thing data steuerung_an     [ readStart="12288", readValueType="bit", writeStart="12288", writeValueType="bit", writeType="coil" ]
.....
    }
}


You’ll have to explain that. Each poll either works or it doesn’t, failure will be reported in your openhab.log.
I don’t know quite what Items going into error looks like, it’s usually the Things that are affected.

Quite a few Modbus-TCP devices can benefit from minor tweaks, like increasing the time between polls, or reducing connect-disconnect rates. For any given device, you have to experiment a bit.

Some background

I will try to explain that:
I get the current outside temperature from a weather service. I send this to the WAGO every 15 minutes. This recalculates the target temperatures of the water for the heating circuits in the WAGO. I read these values back out of the wago for display purposes.

In the event of a failure, the outside temperature is no longer taken over, and the target temperatures are also no longer reported back.

I had such an incident the last few days (see picture).

  1. first failure
  2. restart of the modbus binding via karaf console,
  3. shortly afterwards, the values froze again.
  4. reboot of the pi

blue (covering green): calculated target temperatures (Thing data md_soll_vl_eg / md_soll_vl_og)
pink : outside temperature (from weather service)
red : temperature of the modbus channel to the Wago (Thing data md_aussentemp)

I believe I have observed that the items sometimes do not show any malfunction - I am not sure about that now. The primary problem, however, is the freezing (unresponsiveness) of the modbus channel(s).

I notice it immediately on the chart for these items, but the other items are also affected. Whether all channels are affected or only the channels of a single “bridge poller”, I can’t say at the moment.

Since the problem only occurs sporadically:
What things should I check the next time this happens in order to track down the problem? Then we could discuss it further based on that ?

So how does that happen? Guessing by sending commands to Items? Inspect your events.log to see if that continues to happen. If this part is carried out by rules, it should carry on regardless of any Modbus issue.

Looking at Items and Item states isn’t going to enlighten you any further - they have little to do with Modbus, which is dealt with by the Things.

Look in your openhab.log for Modbus error messages.

You can do all that looking back at the recent incident you’ve already shown in the chart.

At next incident, use the Admin part of your GUI to see what state Modbus Things are in.

Every Modbus data Thing has timestamping channels.

You might learn something by temporarily linking say the lastWriteError channel of one of your write thing, and the lastReadError channel of one of your sleepy read things. Link these to DateTime type Items - changes will be visible in your events.log even if you don’t put them in your UI.
Also, the lastReadSuccess channel of a suspect read thing. Taken together, you will see errors or simply polling stopped.

I’ve never seen any instance of the binding “losing” a poller; but stuff just stopping has been a symptom of general performance bottlenecks, which may occur anywhere in your system.
Let’s see if you get actual errors first.
Certainly not going to suggest DEBUG logging when we have seen zero logs at all so far.

I would not recommend that. If it doesn’t work after 2 or 3 goes, it is not going to work.

You should have a look at that performance guide I linked to.

rule "IBBW_Set_Temperature"
when
    Time cron "0 */15 * ? * *"
then
    temp_soll = transform("JS", "round2.js", OO_Temperature.state.toString + " 1")
    temp_wago = IBBW_md_aussentemp.state as Number

    logInfo("IBBW_Set_Temperature", "temp_soll={}, temp_wago={} ",temp_soll, temp_wago)

    if(temp_soll.toString != temp_wago.toString) {
       IBBW_md_aussentemp.sendCommand(temp_soll.toString)     
    }
end

I did a grep on modbus and got this:

2022-09-20 20:14:17.209 [INFO ] [rt.modbus.internal.ModbusManagerImpl] - Modbus manager activated
2022-09-25 21:05:20.793 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 10 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=0, length=8, maxTries=10]). Will try again soon. Error was I/O error, so resetting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: SocketTimeoutException Read timed out [operation ID b6d61a14-01d0-41cd-838e-c9a5f474bff1]
2022-09-25 21:05:22.384 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=512, length=8, maxTries=10] [operation ID 8d88bfc5-e94a-4e04-84d8-2f62df49df95]
2022-09-25 21:05:22.936 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=0, length=8, maxTries=10] [operation ID b6d61a14-01d0-41cd-838e-c9a5f474bff1]
2022-09-25 21:05:23.488 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=12290, length=28, maxTries=10] [operation ID d538f864-913f-44b9-a504-537f24647f0d]
2022-09-25 21:05:25.851 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=12288, length=5, maxTries=3] [operation ID 0a097aeb-1997-4352-b951-1c41cc977c77]
2022-09-25 21:05:56.599 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl] - Connect reached max tries 10, throwing last error: Das Netzwerk ist nicht erreichbar (connect failed). Connection TCPMasterConnection [m_Socket=Socket[unconnected], m_Timeout=3000, m_Connected=false, m_Address=heizung.fritz.box/192.168.178.201, m_Port=502, m_ModbusTransport=net.wimpi.modbus.io.ModbusTCPTransport@1c1a3da, m_ConnectTimeoutMillis=10000, rtuEncoded=false]. Endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]
2022-09-25 21:05:56.600 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl] - Error connecting connection TCPMasterConnection [m_Socket=Socket[unconnected], m_Timeout=3000, m_Connected=false, m_Address=heizung.fritz.box/192.168.178.201, m_Port=502, m_ModbusTransport=net.wimpi.modbus.io.ModbusTCPTransport@1c1a3da, m_ConnectTimeoutMillis=10000, rtuEncoded=false] for endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]: Das Netzwerk ist nicht erreichbar (connect failed)
2022-09-25 21:05:56.602 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=12288, length=5, maxTries=3] [operation ID 945fe3f2-4535-4791-bb9a-68f41ca8cbcb]
2022-09-25 21:05:58.229 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=512, length=8, maxTries=10] [operation ID 07c3a277-680a-48c3-8225-ed07833be179]
2022-09-25 21:05:58.779 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=0, length=8, maxTries=10] [operation ID 053beade-d7d9-4726-8a74-9837eb056eb6]
2022-09-25 21:05:59.555 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=12290, length=28, maxTries=10] [operation ID f17ba484-ecb4-4a8b-8ea2-f4255522094d]
2022-09-25 21:15:15.683 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=12288, length=5, maxTries=3]). Will try again soon. Error was I/O error, so resetting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception - failed to write: Die Verbindung wurde vom Kommunikationspartner zurĂŒckgesetzt (Write failed) [operation ID 89efdcef-e9ff-4c5a-b70f-a7dcdb4cfb34]
2022-09-25 21:24:28.746 [INFO ] [rt.modbus.internal.ModbusManagerImpl] - Modbus manager activated
2022-09-25 21:30:00.939 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl] - Connect reached max tries 10, throwing last error: Das Netzwerk ist nicht erreichbar (connect failed). Connection TCPMasterConnection [m_Socket=Socket[unconnected], m_Timeout=3000, m_Connected=false, m_Address=heizung.fritz.box/192.168.178.201, m_Port=502, m_ModbusTransport=net.wimpi.modbus.io.ModbusTCPTransport@8272b6, m_ConnectTimeoutMillis=10000, rtuEncoded=false]. Endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]
2022-09-25 21:30:00.940 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl] - Error connecting connection TCPMasterConnection [m_Socket=Socket[unconnected], m_Timeout=3000, m_Connected=false, m_Address=heizung.fritz.box/192.168.178.201, m_Port=502, m_ModbusTransport=net.wimpi.modbus.io.ModbusTCPTransport@8272b6, m_ConnectTimeoutMillis=10000, rtuEncoded=false] for endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]: Das Netzwerk ist nicht erreichbar (connect failed)
2022-09-25 21:30:00.949 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusWriteRegisterRequestBlueprint [slaveId=1, reference=12314, registers=ModbusRegisterArray(00600000), maxTries=3, getFunctionCode()=WRITE_MULTIPLE_REGISTERS] [operation ID a49e14a6-a372-42a0-ba06-22ab383945d1]
2022-09-25 21:30:00.952 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=512, length=8, maxTries=10] [operation ID cb391f02-22fc-4f60-8628-35dcf1b4fd20]
2022-09-26 15:09:25.856 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Error getting a new connection for endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]. Error was: java.lang.InterruptedException null
2022-09-26 15:09:25.858 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=0, length=8, maxTries=10] [operation ID 8daba2ec-c13f-48dd-9b9c-63e2895ce224]
2022-09-26 15:09:25.916 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Error getting a new connection for endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]. Error was: java.lang.InterruptedException null
2022-09-26 15:09:25.917 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=12288, length=5, maxTries=3] [operation ID 8721b1ea-1a5a-4e63-9755-74ca4e1d5ca3]
2022-09-26 15:09:25.974 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Error getting a new connection for endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]. Error was: java.lang.InterruptedException null
2022-09-26 15:09:25.975 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=512, length=8, maxTries=10] [operation ID befbcd0d-c586-4b92-9c94-b5fc5220ad56]
2022-09-26 15:09:27.982 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Error getting a new connection for endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]. Error was: java.lang.InterruptedException null
2022-09-26 15:09:27.983 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=12290, length=28, maxTries=10] [operation ID 8d12af6c-e9d6-4121-b683-f9f93283a1e5]
2022-09-26 15:09:28.010 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Error getting a new connection for endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]. Error was: java.lang.InterruptedException null
2022-09-26 15:09:28.010 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Error getting a new connection for endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]. Error was: java.lang.InterruptedException null
2022-09-26 15:09:28.011 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusWriteRegisterRequestBlueprint [slaveId=1, reference=12314, registers=ModbusRegisterArray(00580000), maxTries=3, getFunctionCode()=WRITE_MULTIPLE_REGISTERS] [operation ID 292713ec-cc40-4dbe-b671-6fcb7b468e9e]
2022-09-26 15:09:28.011 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusWriteRegisterRequestBlueprint [slaveId=1, reference=12314, registers=ModbusRegisterArray(00510000), maxTries=3, getFunctionCode()=WRITE_MULTIPLE_REGISTERS] [operation ID e1974a8b-6f49-40eb-b3dd-fa03e3f8fd06]
2022-09-26 15:09:28.012 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Error getting a new connection for endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]. Error was: java.lang.InterruptedException null
2022-09-26 15:09:28.012 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Error getting a new connection for endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]. Error was: java.lang.InterruptedException null
2022-09-26 15:09:28.012 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Error getting a new connection for endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]. Error was: java.lang.InterruptedException null
2022-09-26 15:09:28.013 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusWriteRegisterRequestBlueprint [slaveId=1, reference=12314, registers=ModbusRegisterArray(00580000), maxTries=3, getFunctionCode()=WRITE_MULTIPLE_REGISTERS] [operation ID 86299648-3353-449a-9da2-9e8fecbeb1e9]
2022-09-26 15:09:28.013 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusWriteRegisterRequestBlueprint [slaveId=1, reference=12314, registers=ModbusRegisterArray(00580000), maxTries=3, getFunctionCode()=WRITE_MULTIPLE_REGISTERS] [operation ID 786f1db2-a0f0-40ff-9fec-350d2ff96902]
2022-09-26 15:09:28.014 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusWriteRegisterRequestBlueprint [slaveId=1, reference=12314, registers=ModbusRegisterArray(00580000), maxTries=3, getFunctionCode()=WRITE_MULTIPLE_REGISTERS] [operation ID a69add47-9b97-4d0f-849e-1bde926aa78e]
2022-09-26 15:09:28.015 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Error getting a new connection for endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]. Error was: java.lang.IllegalStateException Pool not open
2022-09-26 15:09:28.015 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Error getting a new connection for endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]. Error was: java.lang.IllegalStateException Pool not open
2022-09-26 15:09:28.072 [INFO ] [rt.modbus.internal.ModbusManagerImpl] - Modbus manager activated
2022-09-26 17:07:02.849 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 10 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=0, length=8, maxTries=10]). Will try again soon. Error was I/O error, so resetting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception - failed to write: Die Verbindung wurde vom Kommunikationspartner zurĂŒckgesetzt (Write failed) [operation ID 9cfd946a-2a15-48d9-ae40-1166d21ab9f8]
2022-09-26 17:16:01.223 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl] - Connect reached max tries 10, throwing last error: Das Netzwerk ist nicht erreichbar (connect failed). Connection TCPMasterConnection [m_Socket=Socket[unconnected], m_Timeout=3000, m_Connected=false, m_Address=heizung.fritz.box/192.168.178.201, m_Port=502, m_ModbusTransport=net.wimpi.modbus.io.ModbusTCPTransport@969252, m_ConnectTimeoutMillis=10000, rtuEncoded=false]. Endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]
2022-09-26 17:16:01.225 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl] - Error connecting connection TCPMasterConnection [m_Socket=Socket[unconnected], m_Timeout=3000, m_Connected=false, m_Address=heizung.fritz.box/192.168.178.201, m_Port=502, m_ModbusTransport=net.wimpi.modbus.io.ModbusTCPTransport@969252, m_ConnectTimeoutMillis=10000, rtuEncoded=false] for endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]: Das Netzwerk ist nicht erreichbar (connect failed)
2022-09-26 17:16:01.227 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=12290, length=28, maxTries=10] [operation ID 0f2022f5-e0eb-4be5-99d6-4c597b2c3a08]
2022-09-26 17:16:01.776 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=512, length=8, maxTries=10] [operation ID d618fc8a-1252-4551-b89d-07eed9269f3c]
2022-09-26 17:18:43.894 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl] - Connect reached max tries 10, throwing last error: Das Netzwerk ist nicht erreichbar (connect failed). Connection TCPMasterConnection [m_Socket=Socket[unconnected], m_Timeout=3000, m_Connected=false, m_Address=heizung.fritz.box/192.168.178.201, m_Port=502, m_ModbusTransport=net.wimpi.modbus.io.ModbusTCPTransport@d54e9a, m_ConnectTimeoutMillis=10000, rtuEncoded=false]. Endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]
2022-09-26 17:18:43.895 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl] - Error connecting connection TCPMasterConnection [m_Socket=Socket[unconnected], m_Timeout=3000, m_Connected=false, m_Address=heizung.fritz.box/192.168.178.201, m_Port=502, m_ModbusTransport=net.wimpi.modbus.io.ModbusTCPTransport@d54e9a, m_ConnectTimeoutMillis=10000, rtuEncoded=false] for endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]: Das Netzwerk ist nicht erreichbar (connect failed)
2022-09-26 17:18:43.897 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=12290, length=28, maxTries=10] [operation ID 012bf8e5-80da-4bb1-bb60-80997e2e187e]
2022-09-26 17:18:44.447 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=512, length=8, maxTries=10] [operation ID 59dcea54-86df-4c6c-bd64-b8b05961dcbe]
2022-09-26 17:18:44.996 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=0, length=8, maxTries=10] [operation ID 06def206-0139-46d3-b15f-531b738f0187]
2022-09-26 17:18:45.546 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=12288, length=5, maxTries=3] [operation ID 3ec6a041-27b3-410d-9fe9-4875a2e82651]
2022-09-26 17:19:13.736 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 10 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=12290, length=28, maxTries=10]). Will try again soon. Error was I/O error, so resetting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: SocketTimeoutException Read timed out [operation ID 0e45be52-d81c-44c2-91fb-1016802d35ee]
2022-09-26 17:22:19.237 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=12290, length=28, maxTries=10] [operation ID aa4b8317-d32a-44ee-8059-115e23b722e1]
2022-09-26 17:22:19.787 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=512, length=8, maxTries=10] [operation ID c4a9a388-d987-4725-bdd7-6264ddcc0e22]
2022-09-26 17:22:20.339 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=0, length=8, maxTries=10] [operation ID 677cb58b-1357-445b-8618-27fdbebc2156]
2022-09-26 17:22:20.887 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=12288, length=5, maxTries=3] [operation ID 34c76e08-a96c-4e2b-a10f-94f5b43140b0]
2022-09-26 17:22:39.579 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=12290, length=28, maxTries=10] [operation ID 76a155fd-fb48-44a1-a39e-5920b33e850e]

I will change this and read the guide 
 now :wink:

EDIT:
I started reading (and understanding) but have not finished yet.
But for the moment I already have changed ym config to this:

Bridge modbus:tcp:wago_1 [ host="heizung.fritz.box", port=502, id=1, connectMaxTries=3, reconnectAfterMillis=600000, timeBetweenReconnectMillis=100]
{
    Bridge poller io [ start=12288, length=5, type="coil", refresh=5000 ] 
    {......

Do you have the GND connected between the Master and the Slaves?
I have had problems when that was not the case.

I am not sure what you mean by “master” and “slave”.
Its a controller with bus-plugged extension cards.

Do you mean some of these connections:

I just saw that you use Modbus TCP. My comment was related to serial connection so probably it will haveno effect. Although connecting the ground terminal to your protective earth (green yellow wire) should be done (if not already connected).
In serial connection the Modbus device that polls is called master, and you can connect max 32 slaves. In Modbus TCP slaves are called servers.

The other end has stopped talking to us.
That may be because the query never got there; problems in your network, wonky wires, etc.
Or because the far end didn’t understand the message (though it is considered polite to send a reject response, not just stay silent).
Or the far end was too busy doing something else to deal with us (it is possible to send a “not now” response, but not common).
Or because a reply never made it back; problems in your network etc.

See how it goes, having reduced the TCP connect/disconnect churning effect considerably.

I would have expected problems in that area to manifest as a fairly steady error rate though, and not really as periods of “sleep”.
Having said that, we don’t know how well the WAGO manages its TCP connections, and once messed up it may be that you just have to wait for something to expire on a timeout.

This introduces another layer that might go wrong.
The binding will use a hostname like that, but of course it must look up the hostname to get a real IP. You are relying on that lookup being reliable.
If possible, try giving your WAGO a fixed IP and use that (like most binding users).

All right, thanks so far. I will now observe this for a while.
At the same time, I will try to better understand the modbus communication and it’s options.
The links have already helped me a lot :+1:

Good hint. It’s already fixed but I use the dns.
But I don’t want to change too much at once to get to the root of the problem.

It has occurred again. I have made a screenshot of the affected items:

I then replaced the name in the rules file with the IP address.

ridge modbus:tcp:wago_1 [ host="192.168.178.201", port=502, id=1, connectMaxTries=3, reconnectAfterMillis=600000, timeBetweenReconnectMillis=100]
{
    Bridge poller io [ start=12288, length=5, type="coil", refresh=5000 ] 
    {
...

Since I changed the rules.file, the items no longer have any errors. However, the temperature in the Wago is still not updated.
I connected to the Wago with CoDeSys and the temperature from this morning is still entered there (14.2°C). I tried to set the temperature to 17°C first and then to 15.4°C (current temperature) using a manipulated rule. The value of the channel is changed, but no information arrives at the Wago.
(I have also observed this behaviour before: At first the sending still seems to work - but in fact the information no longer arrives at the target system. If the system is then left to run for some time, the send channel also remains at the old value.)

The log shows a connection failure - but this was definitely connected to a modification of my LAN and a switch. Shortly afterwards (approx. 10 minutes) everything worked again, but modbus seems to have stopped in the error.

openhab.log
2022-10-01 14:28:33.660 [INFO ] [rt.modbus.internal.ModbusManagerImpl] - Modbus manager activated
2022-10-03 11:42:48.085 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=12290, length=28, maxTries=3]). Will try again soon. Error was I/O error, so resetting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: SocketTimeoutException Read timed out [operation ID 0f0a2065-c2cc-46b9-b599-2f3fb75f6f89]
2022-10-03 11:43:19.332 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl] - Connect reached max tries 3, throwing last error: connect timed out. Connection TCPMasterConnection [m_Socket=Socket[unconnected], m_Timeout=3000, m_Connected=false, m_Address=heizung.fritz.box/192.168.178.201, m_Port=502, m_ModbusTransport=null, m_ConnectTimeoutMillis=10000, rtuEncoded=false]. Endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]
2022-10-03 11:43:19.334 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl] - Error connecting connection TCPMasterConnection [m_Socket=Socket[unconnected], m_Timeout=3000, m_Connected=false, m_Address=heizung.fritz.box/192.168.178.201, m_Port=502, m_ModbusTransport=null, m_ConnectTimeoutMillis=10000, rtuEncoded=false] for endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]: connect timed out
2022-10-03 11:43:39.357 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl] - KeyedPooledModbusSlaveConnectionFactory: Unknown host: heizung.fritz.box: TemporÀrer Fehler bei der Namensauflösung. Connection creation failed.
2022-10-03 11:43:39.359 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=0, length=8, maxTries=3] [operation ID 19f4aa5c-3d9a-4519-a5ae-0d91f235af21]
2022-10-03 11:43:39.359 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl] - Error connecting connection null for endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]: null
2022-10-03 11:43:39.360 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=12288, length=5, maxTries=3] [operation ID ab9ef968-ae37-44eb-a2f1-c48b94715d52]

events.log:
2022-10-03 11:43:39.370 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:data:wago_1:inputs_digital:di_not_used_03' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Error (ModbusConnectionException) with read. Request: ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=0, length=8, maxTries=3]. Description: ModbusConnectionException(Error connecting to endpoint=ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]). Message: Error connecting to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]
2022-10-03 11:43:39.372 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:data:wago_1:io:steuerung_an' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Error (ModbusConnectionException) with read. Request: ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=12288, length=5, maxTries=3]. Description: ModbusConnectionException(Error connecting to endpoint=ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]). Message: Error connecting to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]
2022-10-03 11:43:39.374 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:data:wago_1:io:regelung_og_an' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Error (ModbusConnectionException) with read. Request: ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=12288, length=5, maxTries=3]. Description: ModbusConnectionException(Error connecting to endpoint=ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]). Message: Error connecting to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]
2022-10-03 11:43:39.376 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:data:wago_1:inputs_digital:warmwasserladung' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Error (ModbusConnectionException) with read. Request: ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=0, length=8, maxTries=3]. Description: ModbusConnectionException(Error connecting to endpoint=ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]). Message: Error connecting to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]
2022-10-03 11:43:39.378 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:data:wago_1:io:heizkreis_eg_an' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Error (ModbusConnectionException) with read. Request: ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=12288, length=5, maxTries=3]. Description: ModbusConnectionException(Error connecting to endpoint=ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]). Message: Error connecting to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]
2022-10-03 11:43:39.379 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:data:wago_1:inputs_digital:di_not_used_01' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Error (ModbusConnectionException) with read. Request: ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=0, length=8, maxTries=3]. Description: ModbusConnectionException(Error connecting to endpoint=ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]). Message: Error connecting to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]
2022-10-03 11:43:39.380 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:data:wago_1:inputs_digital:di_not_used_02' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Error (ModbusConnectionException) with read. Request: ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=0, length=8, maxTries=3]. Description: ModbusConnectionException(Error connecting to endpoint=ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]). Message: Error connecting to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]
2022-10-03 11:43:39.381 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:data:wago_1:io:regelung_eg_an' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Error (ModbusConnectionException) with read. Request: ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=12288, length=5, maxTries=3]. Description: ModbusConnectionException(Error connecting to endpoint=ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]). Message: Error connecting to endpoint ModbusIPSlaveEndpoint [address=heizung.fritz.box, port=502]


Because of this behaviour, I suspect at the moment that possibly temporary connection problems are leading to permanent problems in the modbus protocol.


After a few more attempts, the temperature is still not passed on to the Wago. So I have now restarted the modbus binding via the karaf console and immediately the old value (14.2°C) that was still in the Wago is reported back to the channel in the Openhab.

2022-10-03 18:22:09.699 [INFO ] [rt.modbus.internal.ModbusManagerImpl] - Modbus manager activated
...
...
...
2022-10-03 18:22:12.059 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:data:wago_1:holdings:md_sttoleranz' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to UNINITIALIZED (BRIDGE_UNINITIALIZED)
2022-10-03 18:22:12.065 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:wago_1' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2022-10-03 18:22:12.078 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:wago_1' changed from INITIALIZING to ONLINE
....
2022-10-03 18:22:12.369 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:data:wago_1:holdings:md_steilog' changed from INITIALIZING to ONLINE
2022-10-03 18:22:12.373 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:data:wago_1:holdings:md_stfaktor2' changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING
2022-10-03 18:22:12.375 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:data:wago_1:holdings:md_aussentemp' changed from INITIALIZING to ONLINE
2022-10-03 18:22:12.377 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:data:wago_1:holdings:md_stfaktor2' changed from INITIALIZING to ONLINE
2022-10-03 18:22:12.378 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:data:wago_1:holdings:md_steileg' changed from INITIALIZING to ONLINE
2022-10-03 18:22:17.463 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'IBBW_md_aussentemp' changed from 15.4 to 14.2

For me, this seems to indicate a binding-internal problem, doesn’t it?


Update : now I getting permanent modbus warnings (all modbus items still green!):

==> /var/log/openhab/openhab.log <==

2022-10-03 19:57:20.371 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=12288, length=5, maxTries=3]). Will try again soon. Error was I/O error, so resetting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: SocketTimeoutException Read timed out [operation ID d8b24f11-1f6e-4861-a55a-f0e33c16be7a]
2022-10-03 19:57:28.718 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=0, length=8, maxTries=3]). Will try again soon. Error was I/O error, so resetting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: SocketTimeoutException Read timed out [operation ID b6607b14-d63e-4ee1-b705-1ea92b54abaf]
2022-10-03 19:57:32.986 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=512, length=8, maxTries=3]). Will try again soon. Error was I/O error, so resetting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: SocketTimeoutException Read timed out [operation ID 8ff25c5e-cee1-4b9d-a56d-e644154603f9]
2022-10-03 19:57:38.684 [INFO ] [rnal.service.RemoteControllerService] - Using WebSocket interface
2022-10-03 19:57:39.110 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 2 out of 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=0, length=8, maxTries=3]). Will try again soon. Error was I/O error, so resetting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: SocketTimeoutException Read timed out [operation ID b6607b14-d63e-4ee1-b705-1ea92b54abaf]
2022-10-03 19:57:41.696 [INFO ] [rnal.service.RemoteControllerService] - Using WebSocket interface
2022-10-03 19:57:41.788 [INFO ] [rnal.service.RemoteControllerService] - Using WebSocket interface
2022-10-03 19:57:49.320 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=512, length=8, maxTries=3]). Will try again soon. Error was I/O error, so resetting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: SocketTimeoutException Read timed out [operation ID ade51194-ce4b-401c-bc44-2890d2f0f5c2]
2022-10-03 19:58:05.062 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=12290, length=28, maxTries=3]). Will try again soon. Error was I/O error, so resetting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: SocketTimeoutException Read timed out [operation ID 39d2a203-5d2e-4511-964a-5bc376311ad6]
2022-10-03 19:58:13.158 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=0, length=8, maxTries=3]). Will try again soon. Error was I/O error, so resetting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: SocketTimeoutException Read timed out [operation ID dd44923f-2cc5-495f-a56f-9078553bdab8]
2022-10-03 19:58:32.346 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_COILS, start=12288, length=5, maxTries=3]). Will try again soon. Error was I/O error, so resetting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: SocketTimeoutException Read timed out [operation ID 99f761a5-a8c7-42bd-91bc-4b9fc9e1ce40]
....


finally I restarted the Raspi
 :confused:

Those are Things. I know the names can be confusing, but we’re all going to get in a big mess if we don’t name the parts correctly, Items are something quite different in openHAB.

Still says the same err, thing. The other end has stopped talking to us (or never started).

No. (Also bear in mind there are many other users of this binding)

Errors are still

other end not talking to us.

The binding will re-try a failed transaction a few times (3 by default)
Failing on the first or second attempt generates a WARN, only the last attempt would be an error.

So a bunch of these tells you it’s struggling, but getting by.
Try 2 out of 3 is struggling more.
Try 3 out of 3 failing will generate a terminal error.

So, although we are shouting into the void to determine what went wrong, and getting no response 


We can characterize your problem as “works sometimes”.
openHAB does nothing different between a transaction that works and one that doesn’t.

So it’s probably about timing.
If you’ve configured say 4 poller Things, then openHAB can hit the WAGO quite hard. openHAB expects it to keep up.
Example
OH sends poll request A
OH waits for reply
WAGO responds in a while, sends reply.
OH immediately sends poll request B
WAGO doing something else, can’t handle it that quickly.

You’ve already reduced the TCP disconnect/reconnect thrashing, using
reconnectAfterMillis=600000, that’s good leave that in place.

timeBetweenReconnectMillis=100 just gives a little pause between disconnect/reconnect, so it shouldn’t even happen very often. Leave that in place too.

timeBetweenTransactionsMillis allows you to set a little pause between every transaction, so it’ll give the WAGO a chance to catch its breath before being hit with the next poll.
Set timeBetweenTransactionsMillis=150 and see.

of course, my mind was elsewhere

One does not exclude the other :wink:

Ok, I added timeBetweenTransactionsMillis=150 an will watch it:

Bridge modbus:tcp:wago_1 [ host="192.168.178.201", port=502, id=1, connectMaxTries=3, reconnectAfterMillis=600000, timeBetweenReconnectMillis=100, timeBetweenTransactionsMillis=150]
{
    Bridge poller io [ start=12288, length=5, type="coil", refresh=5000 ] 
    {
       ...

Basic questions, to which I have not yet found an answer:

  • Why does a restart of the binding cause the connection to be restored (even if not completely) without other components involved (LAN/Wago) being restarted/reinitialised (here the temperature was suddenly transferred back from the Wago)?

  • Why does restarting the Raspi restore the connection completely without restarting/re-initialising other components involved (LAN/Wago)?

Did you try to test the reconnect by resetting the Wago?

If possible try also direct LAN connection rPi to Wago to eliminate issues in between.

Because it works sometimes.
When you restart the binding or openHAB, all the Things get reinitialized and attempt their “first” read poll.
Some might work, ta-da.
Some might work after a retry, ta-da.
Some might not.

When one of the read polls fails badly enough (3 out of 3) the associated Thing will throw an error and give up.
Other read polls might carry on, until/unless they too fail badly enough.

Note also that restarting the binding gives the WAGO a pause for breath. If something is getting screwed up at that end, say hanging on to a stale TCP session, there’s time for that to be tidied away as well.
We’re not going to able to reason this out with no idea what is going on inside the WAGO, so it’s a case of try some things that have successfully circumvented bad behaviour of other devices.

Any other factors here, like some other app talking to WAGO at the same time? Other people seem to use WAGO albeit not identical model without these communication issues (search ot6her threads about basic config and programming queries)

I will try a Wago restart the next time.

Do I understand this correctly: If the connection on a channel has failed completely, then this connection will not be repaired by itself, even if the fault has been eliminated? Or is the assumption wrong?

A little background of this Wago: We use exactly this type of Wago (I think more than 50 devices over years now) in our company and work very similarly with it. Permanent polling and, if necessary, writing via modbus-tcp. However, the remote station is not Openhab, but self-written C# programmes. Often even several tcp connections from different PCs at the same time !
I am not aware that we have ever had similar incidents with it in the form of connection problems.

No - it’s only OpenHAB which’s connected to it.


PS:
The Wago I am using here is already the second one, as the first one had a defect and could no longer be booted. Both the old and the new Wago showed the same behaviour with regard to the connection problem.

‘Connection’ is a vague term here. Several modbus pollers trying to use the same remote slave will share one TCP connection. Effectively, that’s what the shared TCP bridge Thing represents. It’s not at channel (or data Thing) level.

TCP connection is routinely broken and made again anew. Normal operation. You get some control over how often the work of breaking/making is performed with the reconnectAfterMillis= stuff.

Error situation; if an error happens to be connection related - as yours are, “hey you” asks openHAB, but gets no response - then part of the recovery attempt is to close the (shared) TCP connection and re-establish a new one.

Might not work of course - the target device might simply be turned off.

More likely, in a real error situation, it could go wrong again because we have no idea what the other end is doing. Will it recognise that old TCP connection has been abandoned? Will it eventualy timeout that old TCP session? Will it refuse to start a new one while the old one lingers? I’ve no idea, WAGO business.

The point here is that connection troubles first encountered by one openHAB poller Thing quickly multiply across them all, because it’s a shared connection.

So far as I know, openHAB will continue to re-try read polls periodically until you configure a poller thing OFFLINE, even if the poller Thing has been flagged with some other error condition. Each scheduled poll is considered as new business, to be individually tried, retried, or failed.

So far as I know, openHAB will re-try a failed write the configured number of times (say 3) and then abandon it. Again, the Thing being in some error state will not stop a later attempt to write by Item command.

Sure. As I’ve pointed out, others do use WAGO with openHAB without noticeable connection issues too.
We’re not looking for something broken here, we’re looking for something that is a little sick, but doesn’t recover very well. And its pretty unique to you, somehow. (Remember host system is in charge of e.g. TCP timeout periods)

There’s two approaches - find the sickness, or improve recovery until it doesn’t matter. Either might be more or less effective in practice. We’re hampered by having only end of a conversation in view, the WAGO remains a black box. Maybe you have the skills to find out what it thinks is going on.

have you tried playing with
https://techdocs.wago.com/Software/eCOCKPIT/en-US/431815435.html

No, 'still running with codesys 2.3

Search for the WAGO Ethernet Settings software ?
taken from here
https://faq.codesys.com/pages/viewpage.action?pageId=3538995