Modbus openHAB2 binding available for alpha testing

Hi!

Check the comment on addressing in the manual openhab2-addons/addons/binding/org.openhab.binding.modbus/README.md at modbus-openhab2-native-binding · ssalonen/openhab2-addons · GitHub

The readStart documentation might be also helpful

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).

1 Like

Hi,

How to implement this configuration?

tcp.slave501.connection=x.x.x.x:502:60:0:0:3:100
tcp.slave501.type=holding
tcp.slave501.start=500
tcp.slave501.length=2
tcp.slave501.valuetype=uint32

I recieved error like this:

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: SocketTimeoutException Read timed out’, cause2=null

New one has slave id but old one does not, is that on purpose? Might cause the device not to respond (and that’s why you would get tcp timeout)

Thank you!

Is it normal that I can take max only 125 length of registers per one poll?
e.g.

Bridge poller holding_R0_to_R125 "FatekPLC_Poller_R0_to_R125" [ start=0, length=125, refresh=1000, type="holding" ] {
}

Hi, there is no hidden limits in the binding , if that is what you are asking

The Modbus protocol itself has the inherent limitation that the count of bytes in the frame must itself be held in a single byte i.e max 255 bytes = 127 registers

https://en.wikipedia.org/wiki/Modbus#Function_code_4_(read_input_registers)and_function_code_3(read_holding_registers)

2 Likes

Dear all

I get following error in my log file:

16:39:54.447 [ERROR] [.wimpi.modbus.io.ModbusTCPTransaction] - execute try 1/1 error: I/O exception: SocketTimeoutException Read timed out. Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@6b002a (unit id 1 & transaction 3646). Address: /192.168.178.30:502
16:39:54.461 [ERROR] [.wimpi.modbus.io.ModbusTCPTransaction] - execute reached max tries 1, throwing last error: I/O exception: SocketTimeoutException Read timed out. Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@6b002a (unit id 1 & transaction 3646). Address: /192.168.178.30:502
16:39:54.474 [WARN ] [ort.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@ae906a[slaveId=1,functionCode=READ_MULTIPLE_REGISTERS,start=0,length=24,maxTries=3]). Will try again soon. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: SocketTimeoutException Read timed out [operation ID f0f19dce-9e8c-424f-b414-d39c81be6cd9]

Does anybody has an idea what is wrong? Any help would be highly appreciated.

Best regards
Rolf

It’s a timeout error as you propably can see. Check all your connection parameters and make sure you server is up and running. You can use some 3rd party modbus tool to do this test.

After all that if you still got problems I would suggest you to open a new thread with much more detailed info about your configuration. This binding is now considered stable and this thread was more about testing and developing.

1 Like

dear Miika

Thanks a lot for your hint. I still get the error and have opended a new thread (as you proposed). Any further help would be highly appreciated.

best regards
rolf

1 Like

Hope this is the right place to ask but having minor problem using OH2 PaperUI to configure ModBus Serial Slave (market:binding-3528471 - 1.0) . It will only allow me to select ttyUSB0 but I have two serial devices and both are listed in /dev ttyUSB0 and ttyUSB1. The same problem arises in the RegoHeatPump binding that is currently running on ttyUSB0.
Tried editing line in PaperUI but it was having none of that. Tried editing the json file but the PaperUI kept over writing it. Tried editing the 99-com.rules as suggested in the serial binding documentation but no luck with that appearing as an option either.
Any hints would be much appreciated.

I think this problem has almost nothing to do with modbus binding. Why don’t you open a new thread with detailed info what you have done so far? I can almost guarantee that you will get much more help that way.

Hi, i have actually also a problem with my Wago 750-881 plc.

im using since years a program on my plc that controls the lights in my house.

for example the program uses the following modbus variable to switch the light using a signal from Modbus (actually IP-Symcon)
fbLichtWohnzimmerLinks AT %MX0.3 :BOOL; ( *ModBus 12291* )
no i want to switch this variable by using openhab2 version 2.3 (the new modbus binding)

things:
Bridge modbus:tcp:hv1 [ host=“192.168.2.10”, port=502 ] {

Bridge poller coil [ start=12291, length=2, refresh=1000, type="holding" ] {
    Thing data do4 [ readStart="12291", readValueType="bit", writeStart="12291", writeValueType="bit", writeType="coil" ]
    Thing data do5 [ readStart="12292", readValueType="bit", writeStart="12292", writeValueType="bit", writeType="coil" ]
}

}

items:
Switch DO4 “Digital Output index 4 [%d]” { channel=“modbus:data:hv1:coil:do4:switch” }
Switch DO5 “Digital Output index 5 [%d]” { channel=“modbus:data:hv1:coil:do5:switch” }

I can do what i want but i dont get any reaction or response by the PLC.

Please help me, actually ißm going crazy

PS: i activated the modbus binding by adding modbus to the addons.cfg is that right

Nope, this long thread contains how to install it; but that is best dealt with in the new thread you have started instead of appending here.

Hi all,

I will disable the Eclipse Marketplace download links as now one should use the official snapshot version. When openHAB 2.4 is out, the new modbus binding will be included as part of that as well. See documentation (“Installation guide”) for more information.

Please open new threads for modbus binding related issues.

Please note that documentation is also merged to the official place: https://www.openhab.org/addons/bindings/modbus/

2 Likes

I’m not sure if its right moment to do such thing. I updated myself to OpenHab 2.3.0 (yes, I’m behind schedule) and I can’t install modbus binding. It is non existent in marketplace and not yet available in features.

Hi,

Did you try to install the snapshot addons by following the installation instructions in openhab.org?

There is no need to have marketplace for this binding, since the openhab project builds snapshot versions as well.

Best
Sami

Hi

I have an issue were i need to write the value to a slave device as a holding register, and read the status from an input.

Normal it would look like this

			    
Bridge poller Smartlight [ start=4538, length=4, refresh=5000, type="holding" ] {
	    
	         Thing data Smartlight [ readStart="4538", readValueType="uint32_swap", writeStart="4538", writeValueType="uint32_swap", writeType="holding" ]

}

But in this case I need the feedback from another address that is an Input register.

Set up separate Things for your read and write paths, the Input register(s) are by definition read-only, but you will have to configure this/these holding regs as write-only (no polling)
Combine them in your Item bindings by simply assigning two channels.