Modbus openHAB2 binding available for alpha testing

Great looking forward to try out the new version :slight_smile:

Iā€™m trying to convert the last part of my old code to the new binding, but having alot of trouble with a Modbus device that needs to have WriteMultiple=true - I did what you wrote and I can see in Paper-UI itā€™s enabled for the wanted Write thing.

I do get this when I try to write to the device:

17:14:35.308 [ERROR] [ort.modbus.internal.ModbusManagerImpl] - Error when executing write request (org.openhab.io.transport.modbus.ModbusWriteRegisterRequestBlueprintImpl@b11b43a): net.wimpi.modbus.ModbusSlaveException Error Code = 1
17:14:35.309 [ERROR] [odbus.handler.ModbusWriteThingHandler] - Unsuccessful write: net.wimpi.modbus.ModbusSlaveException Error Code = 1

My .Thing config

Bridge modbus:tcp:endpointNilan [ host="192.168.100.30", port=502, id=30 ] {
Bridge poller Nilan_Holding_Control [ start=1000, length=8, refresh=5000, type="holding" ] {
        Bridge readwrite Nilan_Control_Type { 
	         Thing read NilanH1000 [ start=0, transform="default", trigger="*", valueType="uint16" ]  
		 Thing write NilanH1000 [ start=0, transform="default", trigger="*", valueType="uint16", type="holding", writeMultipleEvenWithSingleRegister="true" ]  
		 }
	Bridge readwrite Nilan_Control_RunSet { 
		 Thing read NilanH1001 [ start=1, transform="default", trigger="*", valueType="uint16" ]    
		 Thing write NilanH1001 [ start=1, transform="default", trigger="*", valueType="uint16", type="holding", writeMultipleEvenWithSingleRegister="true" ]		 
		 }
	Bridge readwrite Nilan_Control_ModeSet {
		 Thing read NilanH1002 [ start=2, transform="default", trigger="*", valueType="uint16" ]  
		 Thing write NilanH1002 [ start=2, transform="default", trigger="*", valueType="uint16", type="holding", writeMultipleEvenWithSingleRegister="true" ]  
		 }	
	Bridge readwrite Nilan_Control_VentSet {
		 Thing read NilanH1003 [ start=3, transform="default", trigger="*", valueType="uint16" ]  
		 Thing write NilanH1003 [ start=3, transform="default", trigger="*", valueType="uint16", type="holding", writeMultipleEvenWithSingleRegister="true" ]  
	  	 }
	Bridge readwrite Nilan_Control_TempSet {
        	 Thing read NilanH1004 [ start=4, transform="JS(divide100.js)", trigger="*", valueType="uint16" ] 
		 Thing write NilanH1004 [ start=4, transform="JS(multiply100.js)", trigger="*", valueType="uint16", type="holding", writeMultipleEvenWithSingleRegister="true" ]   
		 }
	Bridge readwrite Nilan_Control_ServiceMode { 
		 Thing read NilanH1005 [ start=5, transform="default", trigger="*", valueType="uint16" ] 
		 Thing write NilanH1005 [ start=5, transform="default", trigger="*", valueType="uint16", type="holding", writeMultipleEvenWithSingleRegister="true" ]  
		 }
	Bridge readwrite Nilan_Control_ServicePct {
		 Thing read NilanH1006 [ start=6, transform="default", trigger="*", valueType="uint16" ] 
		 Thing write NilanH1006 [ start=6, transform="default", trigger="*", valueType="uint16", type="holding", writeMultipleEvenWithSingleRegister="true" ]   
		 }	
	Bridge readwrite Nilan_Control_Preset {
		 Thing read NilanH1007 [ start=7, transform="default", trigger="*", valueType="uint16" ] 
		 Thing write NilanH1007 [ start=7, transform="default", trigger="*", valueType="uint16", type="holding", writeMultipleEvenWithSingleRegister="true" ]   
	  	 }	
	

  }

}

Do you have a clue of what iā€™m doing wrong here?

Best Nanna

Hmmā€¦ According to this error code 1 means that the function code is illegal. So the slave is responding with this error codeā€¦

Could you share your old binding config just to double check and correlate for differences?

Perhaps also you can enable more verbose log, trace level for net.wimpi.modbus, org.openhab.io.transport.modbus and org.openhab.binding.modbus. (log:set TRACE org.openhab.io.transport.modbus for example if I recall correctly) and see if that reveals more.

Really appreciate the effort of testing this out. Huge Thanks!

Best
Sami

Iā€™m the one thanking YOU for your effort, making the most important binding ā€˜Modbusā€™.

I have included the relevant part of the modbus.cfg and the binding.

tcp.nilan_holding_control.connection=192.168.100.30:502:60:0:0:3:100
tcp.nilan_holding_control.id=30
tcp.nilan_holding_control.start=1000
tcp.nilan_holding_control.length=8
tcp.nilan_holding_control.type=holding

The Binding

Number Nilan_Control_Type             "Machine type select [%d]"                                             	       (gNilan) {modbus="nilan_holding_control:0"}
Switch Nilan_Control_RunSet           "User on / off select"                                           <switch>        (gNilan) {modbus="nilan_holding_control:1"}
Number Nilan_Control_ModeSet          "User operation mode select [MAP(nilan_control_modeact.map):%s]" <settings>      (gNilan) {modbus="nilan_holding_control:2"}
Number Nilan_Control_VentSet          "User ventilation step select [MAP(nilan_ventset.map):%s]"       <fan_ceiling>   (gNilan) {modbus="nilan_holding_control:3"}
Number Nilan_Control_TempSet          "User temperature setpoint [%.1f Ā°C]"                            <temperature>   (gNilan) {modbus="<[nilan_holding_control:4:transformation=JS(divide100.js)], >[nilan_holding_control:4:transformation=JS(multiply100.js)]"}
Number Nilan_Control_ServiceMode      "Service mode select [MAP(nilan_control_servicemode.map):%s]"    <lock>          (gNilan) {modbus="nilan_holding_control:5"}
Number Nilan_Control_ServicePct       "Service mode capacity [%.1f %%]"                                                (gNilan) {modbus="nilan_holding_control:6"} 
Number Nilan_Control_Preset           "Request preset to factory [%d]"                                                 (gNilan) {modbus="nilan_holding_control:7"}

Nanna

I have set log to TRACE, and this what I get when trying to write to the register:

08:23:37.116 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Nilan_Control_VentSet' received command 4
08:23:37.117 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Smarthouse_Motorventil' received command OFF
08:23:37.119 [TRACE] [ling.ModbusSlaveConnectionFactoryImpl] - Validating endpoint ModbusTCPSlaveEndpoint@4ad7be81[address=192.168.100.30,port=502] connection TCPMasterConnection@58b25fd5[socket=Socket[addr=/192.168.100.30,port=502,localport=37848]] -> true
08:23:37.119 [TRACE] [ort.modbus.internal.ModbusManagerImpl] - borrowing connection (got Optional[TCPMasterConnection@58b25fd5[socket=Socket[addr=/192.168.100.30,port=502,localport=37848]]]) for endpoint ModbusTCPSlaveEndpoint@4ad7be81[address=192.168.100.30,port=502] took 3 ms
08:23:37.137 [ERROR] [ort.modbus.internal.ModbusManagerImpl] - Error when executing write request (org.openhab.io.transport.modbus.ModbusWriteRegisterRequestBlueprintImpl@6371bc74): net.wimpi.modbus.ModbusSlaveException Error Code = 1
08:23:37.138 [TRACE] [ling.ModbusSlaveConnectionFactoryImpl] - destroyObject for connection TCPMasterConnection@58b25fd5[socket=Socket[addr=/192.168.100.30,port=502,localport=37848]] and endpoint ModbusTCPSlaveEndpoint@4ad7be81[address=192.168.100.30,port=502] -> closing the connection
08:23:37.138 [ERROR] [odbus.handler.ModbusWriteThingHandler] - Unsuccessful write: net.wimpi.modbus.ModbusSlaveException Error Code = 1
08:23:37.138 [TRACE] [ort.modbus.internal.ModbusManagerImpl] - Response for write (FC=134) 43 7f 00 00 00 03 1e 86 01 
08:23:37.139 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:write:endpointNilan:Nilan_Holding_Control:Nilan_Control_VentSet:NilanH1003' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Error with writing request org.openhab.io.transport.modbus.ModbusWriteRegisterRequestBlueprintImpl@6371bc74: net.wimpi.modbus.ModbusSlaveException: Error Code = 1
08:23:37.139 [TRACE] [ort.modbus.internal.ModbusManagerImpl] - returned connection for endpoint ModbusTCPSlaveEndpoint@4ad7be81[address=192.168.100.30,port=502]
08:23:37.139 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:readwrite:endpointNilan:Nilan_Holding_Control:Nilan_Control_VentSet' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Error with writing request org.openhab.io.transport.modbus.ModbusWriteRegisterRequestBlueprintImpl@6371bc74: net.wimpi.modbus.ModbusSlaveException: Error Code = 1
08:23:37.140 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:write:endpointNilan:Nilan_Holding_Control:Nilan_Control_VentSet:NilanH1003' changed from OFFLINE (COMMUNICATION_ERROR): Error with writing request org.openhab.io.transport.modbus.ModbusWriteRegisterRequestBlueprintImpl@6371bc74: net.wimpi.modbus.ModbusSlaveException: Error Code = 1 to OFFLINE (BRIDGE_OFFLINE)
08:23:37.140 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:write:endpointNilan:Nilan_Holding_Control:Nilan_Control_VentSet:NilanH1003' changed from UNKNOWN to ONLINE
08:23:37.140 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:write:endpointNilan:Nilan_Holding_Control:Nilan_Control_VentSet:NilanH1003' changed from OFFLINE (BRIDGE_OFFLINE) to UNKNOWN
08:23:37.141 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:readwrite:endpointNilan:Nilan_Holding_Control:Nilan_Control_VentSet' changed from OFFLINE (COMMUNICATION_ERROR): Error with writing request org.openhab.io.transport.modbus.ModbusWriteRegisterRequestBlueprintImpl@6371bc74: net.wimpi.modbus.ModbusSlaveException: Error Code = 1 to ONLINE
08:23:37.141 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:write:endpointNilan:Nilan_Holding_Control:Nilan_Control_VentSet:NilanH1003' changed from ONLINE to OFFLINE (BRIDGE_OFFLINE): Read-write bridge Modbus read-write definition is offline
08:23:37.141 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:read:endpointNilan:Nilan_Holding_Control:Nilan_Control_VentSet:NilanH1003' changed from OFFLINE (BRIDGE_OFFLINE): Read-write bridge Modbus read-write definition is offline to ONLINE
08:23:37.141 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:read:endpointNilan:Nilan_Holding_Control:Nilan_Control_VentSet:NilanH1003' changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)
08:23:37.142 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:write:endpointNilan:Nilan_Holding_Control:Nilan_Control_VentSet:NilanH1003' changed from OFFLINE (BRIDGE_OFFLINE): Read-write bridge Modbus read-write definition is offline to ONLINE
08:23:37.142 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:read:endpointNilan:Nilan_Holding_Control:Nilan_Control_VentSet:NilanH1003' changed from OFFLINE (BRIDGE_OFFLINE) to OFFLINE (BRIDGE_OFFLINE): Read-write bridge Modbus read-write definition is offline
08:23:37.143 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:write:endpointNilan:Nilan_Holding_Control:Nilan_Control_VentSet:NilanH1003' changed from ONLINE to UNKNOWN
08:23:37.144 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:write:endpointNilan:Nilan_Holding_Control:Nilan_Control_VentSet:NilanH1003' changed from UNKNOWN to ONLINE

Hi @ssalonen,

Is there anything I can test according to the connection handling?

Greetings,
Frederic

@FredericMa, please try the latest version from today. It should include the fix I described some time ago. Sorry for the delay, been quite busy with non-openHAB stuff :slight_smile:

@Nanna_Agesen, I notice that in the old binding you do not have writemultipleregisters enabled, but with the new binding you do have writeMultipleEvenWithSingleRegister=true. Perhaps try removing the writeMultipleEvenWithSingleRegister or set it false (the default)? Perhaps your slave does not accept the function code ā€œwrite multipleā€ (as indicated by the error code!).

@all :

I have put some effort to documentation, you can read it here: https://github.com/ssalonen/openhab2-addons/blob/modbus-openhab2-native-binding/addons/binding/org.openhab.binding.modbus/README.md

As you can see, the new binding docs are in the beginning, and old binding docs are now just appended in the end. Naturally this is just WIP, and eventually you would have nice single doc.

Also note that now there is new thing type data to replace read, write and readwrite things. The old things are still there so you can compare the two, hopefully still working as before. Please note that the read/write addresses with data are ā€œabsoluteā€, not relative to poll start as with read and write. Check docs for more explanation on the parameters.

The original concept behind data is described here: Modbus openHAB2 binding available for alpha testing . I have also implemented support for the JSON transformation output as described in the post to cover the more complex use cases.

Please, try it out and check if it feels more natural/simple now? I think I like the new structure better at least :slight_smile:

The old binding have writemultiableregisters enabled, it was in the top of my config, and I did not list it in my post.

I did a check with modbus poll, and it respond OK when I use fc-16 and gave me an error using fc-06.

Did typo writemultiableregisters (should be writemultipleregisters) :smiley: ? I think the old binding just ignored typoed parameters and therefore the setting would not have any effect.

In any case, I think the separate poll confirms that slave just responds with error on FC-06 so everything good from the new binding perspective?

Sorry it was a typo :frowning:

 # sets refresh interval to Modbus polling service.
# Value in milliseconds (optional, defaults to 200)
# poll=
writemultipleregisters=true

This is my config start.

Actually, I think I misunderstood your modbus poll test. So there should not be any error since binding should use Fc 16.

Can you please try with todayā€™s version just to be sure the bug is not fixed

Yes I will give the new version a test tonight.

Best Nanna

1 Like

No problem at all! I was on holiday so there was no stress.
Thank you for your work!

At first sight, everything looks fine according to the connections and the registering and unregistering of polling tasks.
I will do some more checks during the week.

Something else I see now while using the new thing configuration is that I get an error message while using the readValueType uint16 and int16 (the only ones I used until now).
I get this error message on all data things in paper UI:

Out-of-bounds: Poller is reading from index 4000 to 4011 but configuration tries to parse uint16 starting from register 1. Exceeds polled data by -64160 bits

This is my test configuration:

Bridge modbus:tcp:endpointTCP [ host="192.168.50.113", port=502, id=11, reconnectAfterMillis=300000 ] {
	Bridge poller ReadSection1 [ start=4000, length=12, refresh=10000, type="holding" ] {
		Thing data VE_DeviceType [ readStart="1", readValueType="uint16" ]
		
		Thing data VE_DeviceVersion [ readStart="3", readValueType="uint16" ]
		
		Thing data VE_OutsideTemperature [ readStart="8", readValueType="uint16" ]
		
		Thing data VE_OutsideTemperature [ readStart="9", readValueType="uint16" ]	
		
		Thing data VE_InletPressure [ readStart="10", readValueType="uint16" ]
		
		Thing data VE_OutletPressure [ readStart="11", readValueType="uint16" ]
		
	//	Thing data VE_Airflow [ readStart="12", readValueType="uint16" ]
	}
}

Do you have an idea what could be the issue? Do you need more logging on this?

Greetings,
Frederic

As said, the addresses are absolute in data thing :slight_smile: Please refer to docs for more info. I think this makes more sense in the end, although itā€™s quite jarring experience for early testers

In other words readStart should be over 4000 in your case.

Best
Sami

As you explained before is it understood correctly that itā€™s only data thing that are absolute?

I have installed the latest version of the binding and havenā€™t converted yet to Data thing.

Iā€™m getting this warning now

10:42:26.072 [ERROR] [ort.modbus.internal.ModbusManagerImpl] - Unhandled exception in callback: java.lang.IllegalArgumentException Index=4 with type=uint32_swap is out-of-bounds given registers of size 6
java.lang.IllegalArgumentException: Index=4 with type=uint32_swap is out-of-bounds given registers of size 6
	at org.openhab.io.transport.modbus.ModbusBitUtilities.extractStateFromRegisters(ModbusBitUtilities.java:88) ~[?:?]
	at org.openhab.binding.modbus.handler.ModbusReadThingHandler.onRegisters(ModbusReadThingHandler.java:309) ~[?:?]
	at org.openhab.binding.modbus.handler.ModbusReadWriteThingHandler.lambda$3(ModbusReadWriteThingHandler.java:104) ~[?:?]
	at org.openhab.binding.modbus.handler.ModbusReadWriteThingHandler.lambda$6(ModbusReadWriteThingHandler.java:138) ~[?:?]
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) ~[?:?]
	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) ~[?:?]
	at org.openhab.binding.modbus.handler.ModbusReadWriteThingHandler.forEachChildReader(ModbusReadWriteThingHandler.java:137) ~[?:?]
	at org.openhab.binding.modbus.handler.ModbusReadWriteThingHandler.onRegisters(ModbusReadWriteThingHandler.java:103) ~[?:?]
	at org.openhab.binding.modbus.handler.ModbusPollerThingHandlerImpl$ReadCallbackDelegator.lambda$2(ModbusPollerThingHandlerImpl.java:66) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) ~[?:?]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:?]
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[?:?]
	at java.util.Iterator.forEachRemaining(Iterator.java:116) ~[?:?]
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[?:?]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:?]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[?:?]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) ~[?:?]
	at org.openhab.binding.modbus.handler.ModbusPollerThingHandlerImpl$ReadCallbackDelegator.forEachAllChildCallbacks(ModbusPollerThingHandlerImpl.java:61) ~[?:?]
	at org.openhab.binding.modbus.handler.ModbusPollerThingHandlerImpl$ReadCallbackDelegator.onRegisters(ModbusPollerThingHandlerImpl.java:66) ~[?:?]
	at org.openhab.io.transport.modbus.internal.ModbusManagerImpl.invokeCallbackWithResponse(ModbusManagerImpl.java:255) ~[?:?]
	at org.openhab.io.transport.modbus.internal.ModbusManagerImpl.lambda$18(ModbusManagerImpl.java:559) ~[?:?]
	at java.util.Optional.ifPresent(Optional.java:159) ~[?:?]
	at org.openhab.io.transport.modbus.internal.ModbusManagerImpl.lambda$9(ModbusManagerImpl.java:559) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?]
	at java.lang.Thread.run(Thread.java:745) [?:?]

Thing Config

// #Smarthouse EM-24 Energi Analyzer (Address 3506-3678) (174)	

	Bridge poller EM24_Energi [ start=3506, length=6, refresh=5000, type="input" ] {
        Bridge readwrite EM24_Energi_24_AL1 { 
	         Thing read I3506 [ start=0, transform="JS(divide1000.js)", trigger="*", valueType="uint32_swap" ]    
		 }
	Bridge readwrite EM24_Energi_24_AL2 { 	
		 Thing read I3508 [ start=2, transform="JS(divide1000.js)", trigger="*", valueType="uint32_swap" ]	
		 }
	Bridge readwrite EM24_Energi_24_AL3 { 		
		 Thing read I3510 [ start=4, transform="JS(divide1000.js)", trigger="*", valueType="uint32_swap" ]   	     
                 }

Can you short explain the absolute addressing, would the address 3506 that are input be (FC-04 starting with 30) 303506?

As you explained before is it understood correctly that itā€™s only data thing that are absolute?

Indeed, I havenā€™t (at least intentionally) changed behaviour of read and write things.

Absolute addressing (readStart and writeStart parameters of data):

Input as zero-based index number, e.g. in place of 400001 (first holding register), use the address 0. Must be between (poller start) and (poller start + poller length - 1) (inclusive).

When polling registers and reading <16 bit value types you provide REG.ITEM as readStart. The docs explain this in more detail.

Relative addressing (read and write things):

In your example, poller has start=3506. This is the address passed in the modbus protocol as is. Since you are reading input registers, the first polled register has number 30001+3506=33507 (or sometimes written as 303507)

See also this wikipedia article.


Coming back to your error, it looks buggy / unclear indeed.

I think it is corner case not covered by my tests. Please try with updated version (from 15 mins ago)

Just to be sure Iā€™ve got the correct version is it the one from marketplace.eclipse.org?

Hi Again

I got a lot of errors and Ill try to concentrate on one at a time.

Iā€™m trying to read and write from a holding register that is verified to be a Uint32, it needs to be swapped to get the right value.

My thing is configured as below, not yet converted to data thing

// #Smarthouse Varmesetpunkt Udestue
	Bridge poller Setpoint_Udestue [ start=987, length=2, refresh=200, type="holding" ] {
        Bridge readwrite Setpoint_Udestue { 
            Thing read H987 [ start=0, transform="JS(divide10.js)", trigger="*", valueType="uint32_swap" ]    
	    Thing write H987 [ start=0, transform="JS(multiply10.js)", trigger="*", valueType="uint32_swap", type="holding" ]

I get this warning

13:29:57.306 [WARN ] [ort.modbus.internal.ModbusManagerImpl] - Transaction id of the response does not match request ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@7891eb2c[slaveId=1,functionCode=READ_MULTIPLE_REGISTERS,start=987,length=2].  Endpoint ModbusTCPSlaveEndpoint@2fe7d96d[address=192.168.100.86,port=502]. Connection: Optional[TCPMasterConnection@6552dbb9[socket=Socket[addr=/192.168.100.86,port=502,localport=34870]]]. Ignoring response.
13:29:57.308 [WARN ] [s.handler.ModbusReadWriteThingHandler] - Read write thing handler got read error: org.openhab.io.transport.modbus.ModbusUnexpectedTransactionIdException null

As iā€™m reading an Uint32 has anything changed regarding the Length?
I have an start address 987, with a length of 2

Best Nanna

More Details on the error/warning

13:29:57.306 [WARN ] [ort.modbus.internal.ModbusManagerImpl] - Transaction id of the response does not match request ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@7891eb2c[slaveId=1,functionCode=READ_MULTIPLE_REGISTERS,start=987,length=2].  Endpoint ModbusTCPSlaveEndpoint@2fe7d96d[address=192.168.100.86,port=502]. Connection: Optional[TCPMasterConnection@6552dbb9[socket=Socket[addr=/192.168.100.86,port=502,localport=34870]]]. Ignoring response.
13:29:57.308 [WARN ] [s.handler.ModbusReadWriteThingHandler] - Read write thing handler got read error: org.openhab.io.transport.modbus.ModbusUnexpectedTransactionIdException null
13:29:57.309 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:read:endpointSmarthouse:Setpoint_Udestue:Setpoint_Udestue:H987' changed from OFFLINE (BRIDGE_OFFLINE): Read-write bridge Modbus read-write definition is offline to OFFLINE (BRIDGE_OFFLINE)
13:29:57.309 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:read:endpointSmarthouse:Setpoint_Udestue:Setpoint_Udestue:H987' changed from OFFLINE (BRIDGE_OFFLINE) to OFFLINE (BRIDGE_OFFLINE): Read-write bridge Modbus read-write definition is offline
13:29:57.309 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:write:endpointSmarthouse:Setpoint_Udestue:Setpoint_Udestue:H987' changed from OFFLINE (BRIDGE_OFFLINE): Read-write bridge Modbus read-write definition is offline to OFFLINE (BRIDGE_OFFLINE)
13:29:57.310 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:write:endpointSmarthouse:Setpoint_Udestue:Setpoint_Udestue:H987' changed from OFFLINE (BRIDGE_OFFLINE) to UNKNOWN
13:29:57.310 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:readwrite:endpointSmarthouse:Setpoint_Udestue:Setpoint_Udestue' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Read write thing handler got read error: org.openhab.io.transport.modbus.ModbusUnexpectedTransactionIdException null. See logs above for more information
13:29:57.310 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:write:endpointSmarthouse:Setpoint_Udestue:Setpoint_Udestue:H987' changed from UNKNOWN to OFFLINE (BRIDGE_OFFLINE): Read-write bridge Modbus read-write definition is offline
13:29:57.311 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:read:endpointSmarthouse:Setpoint_Udestue:Setpoint_Udestue:H987' changed from ONLINE to OFFLINE (BRIDGE_OFFLINE): Read-write bridge Modbus read-write definition is offline
13:29:57.311 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:write:endpointSmarthouse:Setpoint_Udestue:Setpoint_Udestue:H987' changed from ONLINE to UNKNOWN
13:29:57.311 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:write:endpointSmarthouse:Setpoint_Udestue:Setpoint_Udestue:H987' changed from UNKNOWN to OFFLINE (BRIDGE_OFFLINE): Read-write bridge Modbus read-write definition is offline
13:29:57.312 [ERROR] [modbus.handler.ModbusReadThingHandler] - Thing Modbus read definition received read error: org.openhab.io.transport.modbus.ModbusUnexpectedTransactionIdException null. Stack trace follows for unexpected errors.
org.openhab.io.transport.modbus.ModbusUnexpectedTransactionIdException: null
	at org.openhab.io.transport.modbus.internal.ModbusManagerImpl.lambda$17(ModbusManagerImpl.java:554) ~[?:?]
	at java.util.Optional.ifPresent(Optional.java:159) ~[?:?]
	at org.openhab.io.transport.modbus.internal.ModbusManagerImpl.lambda$8(ModbusManagerImpl.java:553) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?]
	at java.lang.Thread.run(Thread.java:745) [?:?]
13:29:57.313 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:read:endpointSmarthouse:Setpoint_Udestue:Setpoint_Udestue:H987' changed from OFFLINE (BRIDGE_OFFLINE): Read-write bridge Modbus read-write definition is offline to OFFLINE (COMMUNICATION_ERROR): Error with read: org.openhab.io.transport.modbus.ModbusUnexpectedTransactionIdException: null
13:29:57.458 [ERROR] [ort.modbus.internal.ModbusManagerImpl] - Unhandled exception in callback: java.lang.NullPointerException null
java.lang.NullPointerException: null
13:29:57.500 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:readwrite:endpointSmarthouse:Setpoint_Udestue:Setpoint_Udestue' changed from OFFLINE (COMMUNICATION_ERROR): Read write thing handler got read error: org.openhab.io.transport.modbus.ModbusUnexpectedTransactionIdException null. See logs above for more information to ONLINE
13:29:57.501 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:write:endpointSmarthouse:Setpoint_Udestue:Setpoint_Udestue:H987' changed from ONLINE to UNKNOWN
13:29:57.501 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'modbus:write:endpointSmarthouse:Setpoint_Udestue:Setpoint_Udestue:H987' changed from UNKNOWN to ONLINE

Ok as for now it looks like all errors disappeared.

My refresh were set to 1000, I changed it to 5000 and for my things with Uint32_swap it needed to be 8000

1 Like

Just to be sure Iā€™ve got the correct version is it the one from marketplace.eclipse.org2?

Marketplace links to the latest snapshot always so that is the correct version.

13:29:57.306 [WARN ] [ort.modbus.internal.ModbusManagerImpl] - Transaction id of the response does not match request ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@7891eb2c[slaveId=1,functionCode=READ_MULTIPLE_REGISTERS,start=987,length=2]. Endpoint ModbusTCPSlaveEndpoint@2fe7d96d[address=192.168.100.86,port=502]. Connection: Optional[TCPMasterConnection@6552dbb9[socket=Socket[addr=/192.168.100.86,port=502,localport=34870]]]. Ignoring response.

Transaction id is a running number set in the request. Response should have the same number. If not, the binding discard the response (polled data is ignored).

I think you actually found a really hard-to-find bug! The comparison might have used wrong transaction id in some race conditions. I have now fixed the transaction id (~10mins ago), so hopefully it works with short poll periods as well.

As iā€™m reading an Uint32 has anything changed regarding the Length?
I have an start address 987, with a length of 2

Nothing has changed, you specify the number of registers you want to poll.