New modbus binding config problems

Both your serial bridges are trying to use the same device. T̶h̶a̶t̶ ̶w̶o̶n̶’̶t̶ ̶w̶o̶r̶k̶.̶ ̶Y̶o̶u̶ ̶h̶a̶v̶e̶ ̶t̶o̶ ̶u̶s̶e̶ o̶n̶e̶ ̶s̶e̶r̶i̶a̶l̶ ̶b̶r̶i̶d̶g̶e̶ ̶l̶i̶k̶e̶ ̶i̶t̶ ̶w̶a̶s̶ ̶i̶n̶ ̶y̶o̶u̶r̶ ̶f̶i̶r̶s̶t̶e̶x̶a̶m̶p̶l̶e̶.̶

Edit: Yes it works. See below.

I removed the second serial bridge now i have a lot of error’s.
How and where do i set multiple unit id’s?Because i have more then 1 unit id?

2018-12-22 18:03:41.992 [vent.ItemStateChangedEvent] - modbus_data_slave_discreteInputs_di10_lastReadError changed from 2018-12-22T18:03:35.517+0100 to 2018-12-22T18:03:41.966+0100

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

2018-12-22 18:03:43.486 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 01 01 00 00 00 08 3d cc

2018-12-22 18:03:43.489 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: Error reading response (EOF)

2018-12-22 18:03:43.491 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 1/1 error: I/O exception: IOException Error reading response (EOF). Request: net.wimpi.modbus.msg.ReadCoilsRequest@67340112 (unit id 1 & transaction 43). Serial parameters: SerialParameters@3dbd0f3a[portName=/dev/ttyUSB0,baudRate=38400,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=even,encoding=rtu,echo=false,receiveTimeoutMillis=1500]

2018-12-22 18:03:43.494 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute reached max tries 1, throwing last error: I/O exception: IOException Error reading response (EOF). Request: net.wimpi.modbus.msg.ReadCoilsRequest@67340112 (unit id 1 & transaction 43). Serial parameters: SerialParameters@3dbd0f3a[portName=/dev/ttyUSB0,baudRate=38400,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=even,encoding=rtu,echo=false,receiveTimeoutMillis=1500]

2018-12-22 18:03:43.496 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@3b744d74[slaveId=1,functionCode=READ_COILS,start=0,length=8,maxTries=3]). Will try again soon. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: IOException Error reading response (EOF) [operation ID 14b62b86-191d-4ea7-9f75-fc71cf7a48f8]

2018-12-22 18:03:45.099 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 01 01 00 00 00 08 3d cc

2018-12-22 18:03:45.100 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: Error reading response (EOF)

2018-12-22 18:03:45.103 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 1/1 error: I/O exception: IOException Error reading response (EOF). Request: net.wimpi.modbus.msg.ReadCoilsRequest@7bbf4fc4 (unit id 1 & transaction 44). Serial parameters: SerialParameters@3dbd0f3a[portName=/dev/ttyUSB0,baudRate=38400,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=even,encoding=rtu,echo=false,receiveTimeoutMillis=1500]

2018-12-22 18:03:45.105 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute reached max tries 1, throwing last error: I/O exception: IOException Error reading response (EOF). Request: net.wimpi.modbus.msg.ReadCoilsRequest@7bbf4fc4 (unit id 1 & transaction 44). Serial parameters: SerialParameters@3dbd0f3a[portName=/dev/ttyUSB0,baudRate=38400,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=even,encoding=rtu,echo=false,receiveTimeoutMillis=1500]

2018-12-22 18:03:45.107 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 3 failed when executing request (ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@3b744d74[slaveId=1,functionCode=READ_COILS,start=0,length=8,maxTries=3]). Aborting. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: IOException Error reading response (EOF) [operation ID da21e7ce-2591-45d5-8160-b58240ddbd81]

2018-12-22 18:03:45.162 [ERROR] [ernal.handler.ModbusDataThingHandler] - Thing modbus:data:slave:coilsOutputs:do01 'Modbus data' had ModbusSlaveIOExceptionImpl error on read: ModbusSlaveIOException(cause=ModbusIOException, EOF=false, message='I/O exception: IOException Error reading response (EOF)', cause2=null)

==> /var/log/openhab2/events.log <==

2018-12-22 18:03:45.171 [vent.ItemStateChangedEvent] - modbus_data_slave_coilsOutputs_do01_lastReadError changed from 2018-12-22T18:03:22.579+0100 to 2018-12-22T18:03:45.166+0100

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

2018-12-22 18:03:45.172 [ERROR] [ernal.handler.ModbusDataThingHandler] - Thing modbus:data:slave:coilsOutputs:do02 'Modbus data' had ModbusSlaveIOExceptionImpl error on read: ModbusSlaveIOException(cause=ModbusIOException, EOF=false, message='I/O exception: IOException Error reading response (EOF)', cause2=null)

2018-12-22 18:03:45.173 [ERROR] [ernal.handler.ModbusDataThingHandler] - Thing modbus:data:slave:coilsOutputs:do00 'Modbus data' had ModbusSlaveIOExceptionImpl error on read: ModbusSlaveIOException(cause=ModbusIOException, EOF=false, message='I/O exception: IOException Error reading response (EOF)', cause2=null)

2018-12-22 18:03:45.175 [ERROR] [ernal.handler.ModbusDataThingHandler] - Thing modbus:data:slave:coilsOutputs:do04 'Modbus data' had ModbusSlaveIOExceptionImpl error on read: ModbusSlaveIOException(cause=ModbusIOException, EOF=false, message='I/O exception: IOException Error reading response (EOF)', cause2=null)

2018-12-22 18:03:45.178 [ERROR] [ernal.handler.ModbusDataThingHandler] - Thing modbus:data:slave:coilsOutputs:do03 'Modbus data' had ModbusSlaveIOExceptionImpl error on read: ModbusSlaveIOException(cause=ModbusIOException, EOF=false, message='I/O exception: IOException Error reading response (EOF)', cause2=null)

2018-12-22 18:03:45.179 [ERROR] [ernal.handler.ModbusDataThingHandler] - Thing modbus:data:slave:coilsOutputs:do05 'Modbus data' had ModbusSlaveIOExceptionImpl error on read: ModbusSlaveIOException(cause=ModbusIOException, EOF=false, message='I/O exception: IOException Error reading response (EOF)', cause2=null)

==> /var/log/openhab2/events.log <==

2018-12-22 18:03:45.183 [vent.ItemStateChangedEvent] - modbus_data_slave_coilsOutputs_do04_lastReadError changed from 2018-12-22T18:03:22.595+0100 to 2018-12-22T18:03:45.176+0100

I’m not familiar with serial modbus devices but I looked into source code. Here’s what it says when it’s throwing and catching ModbusSlaveIOException:

// IO exception occurred, we re-establish new connection hoping it would fix the issue (e.g.
// broken pipe on write)

So I’d say something’s wrong with serial parameters or the device itself. And you are sure nothing on the hardware side has changed?

I saw that when you were using two serial bridges they had identical names:

Bridge modbus:serial:slave

Try naming them differently and try again with that configuration.

1 Like

Also, why is the parity different in the new configuration? I believe the old configuration did not have parity (“none”).

@gitMiguel is correct, you can specify many serial things but they must have different ids for openHAB to pick them up correctly. Btw it is OK to have many serial things using
the same port but different unit id.

Please note this disclaimer in the docs

With the exception of id parameters should be equal to all serial things sharing the same port .

2 Likes

It’s not that obvious, but here is where you give your slave a unique name. Perhaps something to remind, like
Bridge modbus:serial:adam10 [ ... id=10 ...

You might follow along with
Bridge poller adam10coils [ start=0, ...

These names you choose need to be unique in your configuration

2 Likes

Hello everyone

I indeed had a mistake in my serial bridge parity had to be none.
I adjusted it and adjusted the ID’s like you suggested. And now I do not have any errors anymore. But now I can not switch my switch yet. This is my configuration now

Bridge modbus:serial:slave1 [ port="/dev/ttyUSB0" ,id=1 , baud=38400, stopBits="1", parity="none", dataBits=8, encoding="rtu" ]{

Bridge poller slave1coils [ start=0, length=8, refresh=500, type="coil" ]{
    
        Thing data do00 [ readStart="0", readValueType="bit", writeStart="0", writeValueType="bit", writeType="coil" ]
        Thing data do01 [ readStart="1", readValueType="bit", writeStart="1", writeValueType="bit", writeType="coil" ]
        Thing data do02 [ readStart="2", readValueType="bit", writeStart="2", writeValueType="bit", writeType="coil" ]
        Thing data do03 [ readStart="3", readValueType="bit", writeStart="3", writeValueType="bit", writeType="coil" ]
        Thing data do04 [ readStart="4", readValueType="bit", writeStart="4", writeValueType="bit", writeType="coil" ]
        Thing data do05 [ readStart="5", readValueType="bit", writeStart="5", writeValueType="bit", writeType="coil" ]
        Thing data do06 [ readStart="6", readValueType="bit", writeStart="6", writeValueType="bit", writeType="coil" ]
        Thing data do07 [ readStart="7", readValueType="bit", writeStart="7", writeValueType="bit", writeType="coil" ]

    } 
}     
Bridge modbus:serial:slave2 [ port="/dev/ttyUSB0" ,id=2 , baud=38400, stopBits="1", parity="none", dataBits=8, encoding="rtu" ]{

Bridge poller slave2coils [ start=0, length=8, refresh=500, type="coil" ]{
    
        Thing data do08 [ readStart="0", readValueType="bit", writeStart="0", writeValueType="bit", writeType="coil" ]
        Thing data do09 [ readStart="1", readValueType="bit", writeStart="1", writeValueType="bit", writeType="coil" ]
        Thing data do10 [ readStart="2", readValueType="bit", writeStart="2", writeValueType="bit", writeType="coil" ]
        Thing data do11 [ readStart="3", readValueType="bit", writeStart="3", writeValueType="bit", writeType="coil" ]
        Thing data do12 [ readStart="4", readValueType="bit", writeStart="4", writeValueType="bit", writeType="coil" ]
        Thing data do13 [ readStart="5", readValueType="bit", writeStart="5", writeValueType="bit", writeType="coil" ]
        Thing data do14 [ readStart="6", readValueType="bit", writeStart="6", writeValueType="bit", writeType="coil" ]
        Thing data do15 [ readStart="7", readValueType="bit", writeStart="7", writeValueType="bit", writeType="coil" ]

    } 
} 
Bridge modbus:serial:slave3 [ port="/dev/ttyUSB0" ,id=3 , baud=38400, stopBits="1", parity="none", dataBits=8, encoding="rtu" ]{

Bridge poller slave3coils [ start=0, length=8, refresh=500, type="coil" ]{
    
        Thing data do16 [ readStart="0", readValueType="bit", writeStart="0", writeValueType="bit", writeType="coil" ]
        Thing data do17 [ readStart="1", readValueType="bit", writeStart="1", writeValueType="bit", writeType="coil" ]
        Thing data do18 [ readStart="2", readValueType="bit", writeStart="2", writeValueType="bit", writeType="coil" ]
        Thing data do19 [ readStart="3", readValueType="bit", writeStart="3", writeValueType="bit", writeType="coil" ]
        Thing data do20 [ readStart="4", readValueType="bit", writeStart="4", writeValueType="bit", writeType="coil" ]
        Thing data do21 [ readStart="5", readValueType="bit", writeStart="5", writeValueType="bit", writeType="coil" ]
        Thing data do22 [ readStart="6", readValueType="bit", writeStart="6", writeValueType="bit", writeType="coil" ]
        Thing data do23 [ readStart="7", readValueType="bit", writeStart="7", writeValueType="bit", writeType="coil" ]

    } 
}
Bridge modbus:serial:slave4 [ port="/dev/ttyUSB0" ,id=4 , baud=38400, stopBits="1", parity="none", dataBits=8, encoding="rtu" ]{

Bridge poller slave4coils [ start=0, length=8, refresh=500, type="coil" ]{
    
        Thing data do24 [ readStart="0", readValueType="bit", writeStart="0", writeValueType="bit", writeType="coil" ]
        Thing data do25 [ readStart="1", readValueType="bit", writeStart="1", writeValueType="bit", writeType="coil" ]
        Thing data do26 [ readStart="2", readValueType="bit", writeStart="2", writeValueType="bit", writeType="coil" ]
        Thing data do27 [ readStart="3", readValueType="bit", writeStart="3", writeValueType="bit", writeType="coil" ]
        Thing data do28 [ readStart="4", readValueType="bit", writeStart="4", writeValueType="bit", writeType="coil" ]
        Thing data do29 [ readStart="5", readValueType="bit", writeStart="5", writeValueType="bit", writeType="coil" ]
        Thing data do30 [ readStart="6", readValueType="bit", writeStart="6", writeValueType="bit", writeType="coil" ]
        Thing data do31 [ readStart="7", readValueType="bit", writeStart="7", writeValueType="bit", writeType="coil" ]

    } 
}          
Bridge modbus:serial:slave10 [ port="/dev/ttyUSB0" ,id=10 , baud=38400, stopBits="1", parity="none", dataBits=8, encoding="rtu" ]{ 
   
Bridge poller slave10Inputs [ start=0, length=16, refresh=1, type="discrete" ]{ 
    
       Thing data di00 [ readStart="0", readValueType="bit" ]
       Thing data di01 [ readStart="1", readValueType="bit" ]
       Thing data di02 [ readStart="2", readValueType="bit" ]
       Thing data di03 [ readStart="3", readValueType="bit" ]
       Thing data di04 [ readStart="4", readValueType="bit" ]
       Thing data di05 [ readStart="5", readValueType="bit" ]
       Thing data di06 [ readStart="6", readValueType="bit" ]
       Thing data di07 [ readStart="7", readValueType="bit" ]
       Thing data di08 [ readStart="8", readValueType="bit" ]
       Thing data di09 [ readStart="9", readValueType="bit" ]
       Thing data di10 [ readStart="10", readValueType="bit" ]
       Thing data di11 [ readStart="11", readValueType="bit" ]
       Thing data di12 [ readStart="12", readValueType="bit" ]
       Thing data di13 [ readStart="13", readValueType="bit" ]
       Thing data di14 [ readStart="14", readValueType="bit" ]
       Thing data di15 [ readStart="15", readValueType="bit" ]
          
    }
}   
Bridge modbus:serial:slave11 [ port="/dev/ttyUSB0" ,id=11 , baud=38400, stopBits="1", parity="none", dataBits=8, encoding="rtu" ]{ 
   
Bridge poller slave11Inputs [ start=0, length=16, refresh=1, type="discrete" ]{ 
    
       Thing data di16 [ readStart="0", readValueType="bit" ]
       Thing data di17 [ readStart="1", readValueType="bit" ]
       Thing data di18 [ readStart="2", readValueType="bit" ]
       Thing data di19 [ readStart="3", readValueType="bit" ]
       Thing data di20 [ readStart="4", readValueType="bit" ]
       Thing data di21 [ readStart="5", readValueType="bit" ]
       Thing data di22 [ readStart="6", readValueType="bit" ]
       Thing data di23 [ readStart="7", readValueType="bit" ]
       Thing data di24 [ readStart="8", readValueType="bit" ]
       Thing data di25 [ readStart="9", readValueType="bit" ]
       Thing data di26 [ readStart="10", readValueType="bit" ]
       Thing data di27 [ readStart="11", readValueType="bit" ]
       Thing data di28 [ readStart="12", readValueType="bit" ]
       Thing data di29 [ readStart="13", readValueType="bit" ]
       Thing data di30 [ readStart="14", readValueType="bit" ]
       Thing data di31 [ readStart="15", readValueType="bit" ]
          
    }
}    



And this is my item config

Switch do00 "keuken1" ["Lighting"] { channel="modbus:data:serial:slave1coils:do00:switch" }

What could be wrong with it?

Do you get any hints from logs?

No error log’s only itemCommandEvent

2018-12-23 12:18:33.040 [ome.event.ItemCommandEvent] - Item 'do00' received command ON

Try { channel="modbus:data:slave1:slave1coils:do00:switch }"

There are a couple of too-short polling refresh settings as well

you’ll want refresh=500 or something, more like the other data things

1 Like

Thank you everyone everything is working now.:grinning:
This is the .things

Bridge modbus:serial:slave1 [ port="/dev/ttyUSB0" ,id=1 , baud=38400, stopBits="1", parity="none", dataBits=8, encoding="rtu" ]{

Bridge poller slave1coils [ start=0, length=8, refresh=500, type="coil" ]{
    
        Thing data do00 [ readStart="0", readValueType="bit", writeStart="0", writeValueType="bit", writeType="coil" ]
        Thing data do01 [ readStart="1", readValueType="bit", writeStart="1", writeValueType="bit", writeType="coil" ]
        Thing data do02 [ readStart="2", readValueType="bit", writeStart="2", writeValueType="bit", writeType="coil" ]
        Thing data do03 [ readStart="3", readValueType="bit", writeStart="3", writeValueType="bit", writeType="coil" ]
        Thing data do04 [ readStart="4", readValueType="bit", writeStart="4", writeValueType="bit", writeType="coil" ]
        Thing data do05 [ readStart="5", readValueType="bit", writeStart="5", writeValueType="bit", writeType="coil" ]
        Thing data do06 [ readStart="6", readValueType="bit", writeStart="6", writeValueType="bit", writeType="coil" ]
        Thing data do07 [ readStart="7", readValueType="bit", writeStart="7", writeValueType="bit", writeType="coil" ]

    } 
}     
Bridge modbus:serial:slave2 [ port="/dev/ttyUSB0" ,id=2 , baud=38400, stopBits="1", parity="none", dataBits=8, encoding="rtu" ]{

Bridge poller slave2coils [ start=0, length=8, refresh=500, type="coil" ]{
    
        Thing data do08 [ readStart="0", readValueType="bit", writeStart="0", writeValueType="bit", writeType="coil" ]
        Thing data do09 [ readStart="1", readValueType="bit", writeStart="1", writeValueType="bit", writeType="coil" ]
        Thing data do10 [ readStart="2", readValueType="bit", writeStart="2", writeValueType="bit", writeType="coil" ]
        Thing data do11 [ readStart="3", readValueType="bit", writeStart="3", writeValueType="bit", writeType="coil" ]
        Thing data do12 [ readStart="4", readValueType="bit", writeStart="4", writeValueType="bit", writeType="coil" ]
        Thing data do13 [ readStart="5", readValueType="bit", writeStart="5", writeValueType="bit", writeType="coil" ]
        Thing data do14 [ readStart="6", readValueType="bit", writeStart="6", writeValueType="bit", writeType="coil" ]
        Thing data do15 [ readStart="7", readValueType="bit", writeStart="7", writeValueType="bit", writeType="coil" ]

    } 
} 
Bridge modbus:serial:slave3 [ port="/dev/ttyUSB0" ,id=3 , baud=38400, stopBits="1", parity="none", dataBits=8, encoding="rtu" ]{

Bridge poller slave3coils [ start=0, length=8, refresh=500, type="coil" ]{
    
        Thing data do16 [ readStart="0", readValueType="bit", writeStart="0", writeValueType="bit", writeType="coil" ]
        Thing data do17 [ readStart="1", readValueType="bit", writeStart="1", writeValueType="bit", writeType="coil" ]
        Thing data do18 [ readStart="2", readValueType="bit", writeStart="2", writeValueType="bit", writeType="coil" ]
        Thing data do19 [ readStart="3", readValueType="bit", writeStart="3", writeValueType="bit", writeType="coil" ]
        Thing data do20 [ readStart="4", readValueType="bit", writeStart="4", writeValueType="bit", writeType="coil" ]
        Thing data do21 [ readStart="5", readValueType="bit", writeStart="5", writeValueType="bit", writeType="coil" ]
        Thing data do22 [ readStart="6", readValueType="bit", writeStart="6", writeValueType="bit", writeType="coil" ]
        Thing data do23 [ readStart="7", readValueType="bit", writeStart="7", writeValueType="bit", writeType="coil" ]

    } 
}
Bridge modbus:serial:slave4 [ port="/dev/ttyUSB0" ,id=4 , baud=38400, stopBits="1", parity="none", dataBits=8, encoding="rtu" ]{

Bridge poller slave4coils [ start=0, length=8, refresh=500, type="coil" ]{
    
        Thing data do24 [ readStart="0", readValueType="bit", writeStart="0", writeValueType="bit", writeType="coil" ]
        Thing data do25 [ readStart="1", readValueType="bit", writeStart="1", writeValueType="bit", writeType="coil" ]
        Thing data do26 [ readStart="2", readValueType="bit", writeStart="2", writeValueType="bit", writeType="coil" ]
        Thing data do27 [ readStart="3", readValueType="bit", writeStart="3", writeValueType="bit", writeType="coil" ]
        Thing data do28 [ readStart="4", readValueType="bit", writeStart="4", writeValueType="bit", writeType="coil" ]
        Thing data do29 [ readStart="5", readValueType="bit", writeStart="5", writeValueType="bit", writeType="coil" ]
        Thing data do30 [ readStart="6", readValueType="bit", writeStart="6", writeValueType="bit", writeType="coil" ]
        Thing data do31 [ readStart="7", readValueType="bit", writeStart="7", writeValueType="bit", writeType="coil" ]

    } 
}          
Bridge modbus:serial:slave10 [ port="/dev/ttyUSB0" ,id=10 , baud=38400, stopBits="1", parity="none", dataBits=8, encoding="rtu" ]{ 
   
Bridge poller slave10Inputs [ start=0, length=16, refresh=500, type="discrete" ]{ 
    
       Thing data di00 [ readStart="0", readValueType="bit" ]
       Thing data di01 [ readStart="1", readValueType="bit" ]
       Thing data di02 [ readStart="2", readValueType="bit" ]
       Thing data di03 [ readStart="3", readValueType="bit" ]
       Thing data di04 [ readStart="4", readValueType="bit" ]
       Thing data di05 [ readStart="5", readValueType="bit" ]
       Thing data di06 [ readStart="6", readValueType="bit" ]
       Thing data di07 [ readStart="7", readValueType="bit" ]
       Thing data di08 [ readStart="8", readValueType="bit" ]
       Thing data di09 [ readStart="9", readValueType="bit" ]
       Thing data di10 [ readStart="10", readValueType="bit" ]
       Thing data di11 [ readStart="11", readValueType="bit" ]
       Thing data di12 [ readStart="12", readValueType="bit" ]
       Thing data di13 [ readStart="13", readValueType="bit" ]
       Thing data di14 [ readStart="14", readValueType="bit" ]
       Thing data di15 [ readStart="15", readValueType="bit" ]
          
    }
}   
Bridge modbus:serial:slave11 [ port="/dev/ttyUSB0" ,id=11 , baud=38400, stopBits="1", parity="none", dataBits=8, encoding="rtu" ]{ 
   
Bridge poller slave11Inputs [ start=0, length=16, refresh=500, type="discrete" ]{ 
    
       Thing data di16 [ readStart="0", readValueType="bit" ]
       Thing data di17 [ readStart="1", readValueType="bit" ]
       Thing data di18 [ readStart="2", readValueType="bit" ]
       Thing data di19 [ readStart="3", readValueType="bit" ]
       Thing data di20 [ readStart="4", readValueType="bit" ]
       Thing data di21 [ readStart="5", readValueType="bit" ]
       Thing data di22 [ readStart="6", readValueType="bit" ]
       Thing data di23 [ readStart="7", readValueType="bit" ]
       Thing data di24 [ readStart="8", readValueType="bit" ]
       Thing data di25 [ readStart="9", readValueType="bit" ]
       Thing data di26 [ readStart="10", readValueType="bit" ]
       Thing data di27 [ readStart="11", readValueType="bit" ]
       Thing data di28 [ readStart="12", readValueType="bit" ]
       Thing data di29 [ readStart="13", readValueType="bit" ]
       Thing data di30 [ readStart="14", readValueType="bit" ]
       Thing data di31 [ readStart="15", readValueType="bit" ]
          
    }
}    



And this is my .items

Group Verlichting <verlichting>

 
Switch keuken1 "keuken1" ["Lighting"] { channel="modbus:data:slave1:slave1coils:do00:switch" }
Switch keuken2 "keuken2" ["Lighting"] { channel="modbus:data:slave1:slave1coils:do01:switch" } 
Switch keuken3 "keuken3" ["Lighting"] { channel="modbus:data:slave1:slave1coils:do02:switch" }
Switch living1 "living1" ["Lighting"] { channel="modbus:data:slave1:slave1coils:do03:switch" }
Switch living2 "living2" ["Lighting"] { channel="modbus:data:slave1:slave1coils:do04:switch" }
Switch eetkamer1 "eetkamer1" ["Lighting"] { channel="modbus:data:slave1:slave1coils:do05:switch" }
Switch eetkamer2 "eetkamer2" ["Lighting"] { channel="modbus:data:slave1:slave1coils:do06:switch" }
Switch livingwand "livingwand" ["Lighting"] { channel="modbus:data:slave1:slave1coils:do07:switch" }

Switch bureau "bureau" ["Lighting"] { channel="modbus:data:slave2:slave2coils:do08:switch" }
Switch inkomhal "inkomhal" ["Lighting"] { channel="modbus:data:slave2:slave2coils:do09:switch" }
Switch wasplaats "wasplaats" ["Lighting"] { channel="modbus:data:slave2:slave2coils:do10:switch" }
Switch voordeur "voordeur" ["Lighting"] { channel="modbus:data:slave2:slave2coils:do11:switch" }
Switch garage "garage" ["Lighting"] { channel="modbus:data:slave2:slave2coils:do12:switch" }
Switch douche "douche" ["Lighting"] { channel="modbus:data:slave2:slave2coils:do13:switch" }
Switch kelder "kelder" ["Lighting"] { channel="modbus:data:slave2:slave2coils:do14:switch" }
Switch voor "voor" ["Lighting"] { channel="modbus:data:slave2:slave2coils:do15:switch" }

Switch zijkant "zijkant" ["Lighting"] { channel="modbus:data:slave3:slave3coils:do16:switch" }
Switch achter "achter" ["Lighting"] { channel="modbus:data:slave3:slave3coils:do17:switch" }
Switch hal "hal"  ["Lighting"] { channel="modbus:data:slave3:slave3coils:do18:switch" }
Switch orientatie "orientatie" ["Lighting"] { channel="modbus:data:slave3:slave3coils:do19:switch" }
Switch masterbedroom "masterbedroom" ["Lighting"] { channel="modbus:data:slave3:slave3coils:do20:switch" }
Switch badkamer "badkamer" ["Lighting"] { channel="modbus:data:slave3:slave3coils:do21:switch" }

Switch open1 "open1" { channel="modbus:data:slave4:slave4coils:do22:switch" }
Switch open2 "open2" { channel="modbus:data:slave4:slave4coils:do23:switch" }
Switch open3 "open3" { channel="modbus:data:slave4:slave4coils:do24:switch" }
Switch open4 "open4" { channel="modbus:data:slave4:slave4coils:do25:switch" }
Switch open5 "open5" { channel="modbus:data:slave4:slave4coils:do26:switch" }
Switch open6 "open6" { channel="modbus:data:slave4:slave4coils:do27:switch" }
Switch open7 "open7" { channel="modbus:data:slave4:slave4coils:do28:switch" }
Switch open8 "open8" { channel="modbus:data:slave4:slave4coils:do29:switch" }
Switch open9 "open9" { channel="modbus:data:slave4:slave4coils:do30:switch" }
Switch open10 "open10" { channel="modbus:data:slave4:slave4coils:do31:switch" }

Group Verlichtinginputs <verlichting>


Contact verlichting1 "verlichting1[MAP(en.map):%s]"  { channel="modbus:data:slave10:slave10Inputs:di00:contact" }
Contact verlichting2 "verlichting2[MAP(en.map):%s]"  { channel="modbus:data:slave10:slave10Inputs:di01:contact" }
Contact verlichting3 "verlichting3[MAP(en.map):%s]"  { channel="modbus:data:slave10:slave10Inputs:di02:contact" }
Contact verlichting4 "verlichting4[MAP(en.map):%s]"  { channel="modbus:data:slave10:slave10Inputs:di03:contact" }
Contact verlichting5 "verlichting5[MAP(en.map):%s]"  { channel="modbus:data:slave10:slave10Inputs:di04:contact" }
Contact verlichting6 "verlichting6[MAP(en.map):%s]"  { channel="modbus:data:slave10:slave10Inputs:di07:contact" }
Contact verlichting7 "verlichting7[MAP(en.map):%s]"  { channel="modbus:data:slave10:slave10Inputs:di05:contact" }
Contact verlichting8 "verlichting8[MAP(en.map):%s]"  { channel="modbus:data:slave10:slave10Inputs:di06:contact" }
Contact verlichting9  "verlichting9[MAP(en.map):%s]"  { channel="modbus:data:slave10:slave10Inputs:di08:contact" }
Contact verlichting10 "verlichting10[MAP(en.map):%s]"  { channel="modbus:data:slave10:slave10Inputs:di09:contact" }
Contact verlichting11 "verlichting11[MAP(en.map):%s]"  { channel="modbus:data:slave10:slave10Inputs:di10:contact" }
Contact verlichting12 "verlichting12[MAP(en.map):%s]"  { channel="modbus:data:slave10:slave10Inputs:di11:contact" }
Contact verlichting13 "verlichting13[MAP(en.map):%s]"  { channel="modbus:data:slave10:slave10Inputs:di12:contact" }
Contact verlichting14 "verlichting14[MAP(en.map):%s]"  { channel="modbus:data:slave10:slave10Inputs:di13:contact" }
Contact verlichting15 "verlichting15[MAP(en.map):%s]"  { channel="modbus:data:slave10:slave10Inputs:di14:contact" }
Contact verlichting16 "verlichting16[MAP(en.map):%s]"  { channel="modbus:data:slave10:slave10Inputs:di15:contact" }

Contact verlichting17 "verlichting17[MAP(en.map):%s]"  { channel="modbus:data:slave11:slave11Inputs:di16:contact" }
Contact verlichting18 "verlichting18[MAP(en.map):%s]"  { channel="modbus:data:slave11:slave11Inputs:di17:contact" }
Contact verlichting19 "verlichting19[MAP(en.map):%s]"  { channel="modbus:data:slave11:slave11Inputs:di18:contact" }
Contact verlichting20 "verlichting20[MAP(en.map):%s]"  { channel="modbus:data:slave11:slave11Inputs:di19:contact" }
Contact verlichting21 "verlichting21[MAP(en.map):%s]"  { channel="modbus:data:slave11:slave11Inputs:di20:contact" }
Contact verlichting22 "verlichting22[MAP(en.map):%s]"  { channel="modbus:data:slave11:slave11Inputs:di21:contact" }
Contact verlichting23 "verlichting23[MAP(en.map):%s]"  { channel="modbus:data:slave11:slave11Inputs:di22:contact" }
Contact verlichting24 "verlichting24[MAP(en.map):%s]"  { channel="modbus:data:slave11:slave11Inputs:di23:contact" }
Contact verlichting25 "verlichting25[MAP(en.map):%s]"  { channel="modbus:data:slave11:slave11Inputs:di24:contact" }
Contact verlichting26 "verlichting26[MAP(en.map):%s]"  { channel="modbus:data:slave11:slave11Inputs:di25:contact" }
Contact verlichting27 "verlichting27[MAP(en.map):%s]"  { channel="modbus:data:slave11:slave11Inputs:di26:contact" }
Contact verlichting28 "verlichting28[MAP(en.map):%s]"  { channel="modbus:data:slave11:slave11Inputs:di27:contact" }
Contact verlichting29 "verlichting29[MAP(en.map):%s]"  { channel="modbus:data:slave11:slave11Inputs:di28:contact" }
Contact verlichting30 "verlichting30[MAP(en.map):%s]"  { channel="modbus:data:slave11:slave11Inputs:di29:contact" }
Contact verlichting31 "verlichting31[MAP(en.map):%s]"  { channel="modbus:data:slave11:slave11Inputs:di31:contact" }
Contact verlichting32 "verlichting32[MAP(en.map):%s]"  { channel="modbus:data:slave11:slave11Inputs:di32:contact" }

2 Likes

Nice! :+1:

1 Like

I have a Intesisbox to control Air Condition using Modbus. By using the free Modbus driver here everything is working fine. See picture which also shows the actual parameters used:

where I am fetching 10 registers starting from #1. The connection parameters are 9600 bps, 8 data bits, no parity and 2 stop bits.

Then I am trying to get openHAB binding 2 in version 2.4 to work, but I keep getting

2019-12-03 20:15:15.982 [ERROR] [ernal.handler.ModbusDataThingHandler] - Thing modbus:data:slave01:holdingsREG:ac1unitmode ‘Modbus data’ had ModbusSlaveIOExceptionImpl error on read: ModbusSlaveIOException(cause=ModbusIOException, EOF=false, message=‘I/O exception: IOException Error reading response (EOF)’, cause2=null)

I have tried both paperUI and configuration file, but the result is the same.
My things file looks like this:

Bridge modbus:serial:slave01 [port="/dev/ttyUSB5",baud=9600,id=1,stopBits=“2.0”,parity=“none”,dataBits=8,encoding=“rtu”] {
Bridge poller holdingsREG[ start=1, length=2, refresh=4000, type=“holding”] {
Thing data ac1unitonoff [ readStart=“1”, readValueType=“uint16”, readTransform=“default” ]
Thing data ac1unitmode [ readStart=“2”, readValueType=“uint16”, readTransform=“default” ]
}
}

and my item file:

Number ac1unitonoff { channel=“modbus:data:slave01:holdingsREG:ac1unitonoff:number” }
Number ac1unitmode { channel=“modbus:data:slave01:holdingsREG:ac1unitmode:number” }

The problem seems to be the poll. Below is the error message shown in paperUI for the poll thing.

Status: OFFLINE - COMMUNICATION_ERROR Error with read: org.openhab.io.transport.modbus.internal.ModbusSlaveIOExceptionImpl: Modbus IO Error with cause=ModbusIOException, EOF=false, message=‘I/O exception: IOException Error reading response (EOF)’, cause2=null

I hope that some smart guys can help me identify the problem. Maybe @rossko57 or @gitMiguel

Thanks!

It’s a read error, not much more to say.

I note that your screenshot refers to COM4, but Thing to ttyUSB5 so clearly we are on different boxes and possibly different serial adaptors.
Serial problems often come down to permissions.

The Modpoll test with the screen shot was done on my Win 10 pc, while my openHAB is running on a linux box. But it is physically the same usb to rs485 adapter I just moved between those 2 boxes.

How can I figure out if there is a permission problem in my openHAB box as you mentioned?

The Modbus binding docs give you info to gather more diagnostic information

The Modbus binding docs also refer you to the Serial binding section about port access

https://www.openhab.org/docs/administration/serial.html#linux

Thanks for your reply. With regards to permission, I am using udevadm to fix this as mentioned on this link.

By doing that I should fix permission issue and changing device names. And I am already using one usb port for RFXCOM binding (link) which works fine.

Therefore, I hope that that permissions is not the problem. If I execute

ls -la /dev

it shows these permissions:

crw-rw-rw- 1 openhab users 188, 0 Dec 4 07:30 ttyUSB0
crw-rw-rw- 1 openhab users 188, 1 Dec 4 17:40 ttyUSB1
lrwxrwxrwx 1 root root 7 Dec 3 19:34 ttyUSB5 -> ttyUSB1
lrwxrwxrwx 1 root root 7 Nov 28 22:19 ttyUSB6 -> ttyUSB0

where usb5 is redirected to usb1. usb1 is no longer only for root user as default, but for all users. I guess that should be fine. It is working fine for usb6/usb0 which is my RFXCOM device.

Then I enabled tracing in karaf konsole for these:
log:set TRACE org.openhab.binding.modbus
log:set TRACE org.openhab.io.transport.modbus
log:set TRACE net.wimpi.modbus
log:set TRACE t.wimpi.modbus.io.ModbusRTUTransport

and snippets of the result is:

2019-12-04 17:36:10.923 [TRACE] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 [operation ID 8686ab99-c6c6-435c-82c6-c63595f6921a]
2019-12-04 17:36:10.923 [TRACE] [rt.modbus.internal.ModbusManagerImpl] - Ensuring that enough time passes before retrying again. Sleeping if necessary [operation ID 8686ab99-c6c6-435c-82c6-c63595f6921a]
2019-12-04 17:36:10.924 [TRACE] [rt.modbus.internal.ModbusManagerImpl] - Sleep ended, slept 0 [operation ID 8686ab99-c6c6-435c-82c6-c63595f6921a]
2019-12-04 17:36:10.924 [TRACE] [rt.modbus.internal.ModbusManagerImpl] - Going execute transaction with request request (FC=READ_MULTIPLE_REGISTERS): 00 00 00 00 00 06 01 03 00 01 00 02 [operation ID 8686ab99-c6c6-435c-82c6-c63595f6921a]
2019-12-04 17:36:10.925 [DEBUG] [t.wimpi.modbus.io.ModbusRTUTransport] - Sent: 01 03 00 01 00 02 95 cb
2019-12-04 17:36:12.427 [TRACE] [t.wimpi.modbus.io.ModbusRTUTransport] - Managed to read at least one byte
2019-12-04 17:36:12.428 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 01 03 00 01 00 02 95 cb
2019-12-04 17:36:12.428 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: Error reading response (EOF)
2019-12-04 17:36:12.429 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 1/1 error: I/O exception: IOException Error reading response (EOF). Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@54f33629 (unit id 1 & transaction 257). Serial parameters: SerialParameters@7f92ccd0[portName=/dev/ttyUSB1,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=1500]
2019-12-04 17:36:12.430 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute reached max tries 1, throwing last error: I/O exception: IOException Error reading response (EOF). Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@54f33629 (unit id 1 & transaction 257). Serial parameters: SerialParameters@7f92ccd0[portName=/dev/ttyUSB1,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=1500]
2019-12-04 17:36:12.431 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@51133324[slaveId=1,functionCode=READ_MULTIPLE_REGISTERS,start=1,length=2,maxTries=3]). Will try again soon. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: IOException Error reading response (EOF) [operation ID 8686ab99-c6c6-435c-82c6-c63595f6921a]
2019-12-04 17:36:12.431 [TRACE] [ing.ModbusSlaveConnectionFactoryImpl] - destroyObject for connection SerialConnection@5a2900c6[portName=/dev/ttyUSB1,port=/dev/ttyUSB1] and endpoint ModbusSerialSlaveEndpoint@6e85bf26[portName=/dev/ttyUSB1] -> closing the connection
2019-12-04 17:36:12.516 [TRACE] [rt.modbus.internal.ModbusManagerImpl] - invalidating connection for endpoint ModbusSerialSlaveEndpoint@6e85bf26[portName=/dev/ttyUSB1] took 85 ms
2019-12-04 17:36:12.517 [TRACE] [rt.modbus.internal.ModbusManagerImpl] - Executing task BasicPollTaskImpl@1411bfc2[request=ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@51133324[slaveId=1,functionCode=READ_MULTIPLE_REGISTERS,start=1,length=2,maxTries=3],endpoint=ModbusSerialSlaveEndpoint@6e85bf26[portName=/dev/ttyUSB1],callback=org.openhab.binding.modbus.internal.handler.ModbusPollerThingHandlerImpl$ReadCallbackDelegator@a959ab48] (oneOff=false)! Waiting for connection. Idle connections for this endpoint: 0, and active 0 [operation ID 8686ab99-c6c6-435c-82c6-c63595f6921a]
2019-12-04 17:36:12.517 [TRACE] [ing.ModbusSlaveConnectionFactoryImpl] - Created connection SerialConnection@65b3ca93[portName=/dev/ttyUSB1,port=] for endpoint ModbusSerialSlaveEndpoint@6e85bf26[portName=/dev/ttyUSB1]
2019-12-04 17:36:12.518 [TRACE] [et.wimpi.modbus.net.SerialConnection] - Got Port Identifier
2019-12-04 17:36:12.525 [TRACE] [et.wimpi.modbus.net.SerialConnection] - Got Serial Port
2019-12-04 17:36:12.526 [TRACE] [et.wimpi.modbus.net.SerialConnection] - i/o Streams prepared
2019-12-04 17:36:12.527 [TRACE] [ing.ModbusSlaveConnectionFactoryImpl] - Waited 0ms (interTransactionDelayMillis 200ms) before giving returning connection SerialConnection@65b3ca93[portName=/dev/ttyUSB1,port=/dev/ttyUSB1] for endpoint ModbusSerialSlaveEndpoint@6e85bf26[portName=/dev/ttyUSB1], to ensure delay between transactions.
2019-12-04 17:36:12.527 [TRACE] [rt.modbus.internal.ModbusManagerImpl] - borrowing connection (got Optional[SerialConnection@65b3ca93[portName=/dev/ttyUSB1,port=/dev/ttyUSB1]]) for endpoint ModbusSerialSlaveEndpoint@6e85bf26[portName=/dev/ttyUSB1] took 10 ms
2019-12-04 17:36:12.528 [TRACE] [rt.modbus.internal.ModbusManagerImpl] - Executing task BasicPollTaskImpl@1411bfc2[request=ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@51133324[slaveId=1,functionCode=READ_MULTIPLE_REGISTERS,start=1,length=2,maxTries=3],endpoint=ModbusSerialSlaveEndpoint@6e85bf26[portName=/dev/ttyUSB1],callback=org.openhab.binding.modbus.internal.handler.ModbusPollerThingHandlerImpl$ReadCallbackDelegator@a959ab48] (oneOff=false)! Connection received in 11 ms [operation ID 8686ab99-c6c6-435c-82c6-c63595f6921a]

From this trace above I am not able to identify root cause - unfortunately.

That seems to suggest it got hold of USB1, so that should rule out permission or contention problems.

Séems like a comms issue - is this over the same wire? I’m not sure if post 2.4 versions may have a bit more detail for serial tracing.

It seems I finally found out core reason. I am running openHAB on Synology NAS model DS218+. This model has 2 USB 3.0 ports on the back and 1 USB 3.0 port on the front.

For some unknown reason I cannot use both USB ports on the backside at the same time in openHAB. However, if I connect to one port on the back and one port on the front side, everything is working fine.

Thanks for your support.

Definitely file under “weird”.

1 Like