Modbus openHAB2 binding available for alpha testing

openhab2-addons
modbus
binding
Tags: #<Tag:0x00007f15dfb506e8> #<Tag:0x00007f15dfb505a8> #<Tag:0x00007f15dfb50440>

(Ssalonen) #505

@mbs38 I got the response from Kai in the github discussion thread.

He mentioned that they are working on a generic feature to disable individual “things” temporarily from user code. As far as I understand, disabling means “disposing” the thing, and turning it OFFLINE. With poller poller things this should stop the polling for sure. It might also stop all writes from child data things of this poller.

Would this actually solve your use case?

Best,
Sami


(Ssalonen) #506

I am happy to announce that he binding got merged to official openHAB master. It will be available in the next release!

Very big thanks to all beta testers!


(Bogumil J.) #507

Congratulations :slight_smile:

BTW. Could you help me with configuration of holding registers?
I can’t make it work :confused:
The current configuration I have is:

    Bridge poller holding_R0_to_R3839 "FatekPLC_Poller_R0_to_R3839" [ start=40000, length=3840, refresh=10000, type="holding" ] {
        Thing data FatekPLC_Modbus_R0 "FatekPLC_Modbus_R0" @ "Modbus" [ readStart="40000", readValueType="int16", writeStart="40000", writeValueType="int16", writeType="holding" ]
        Thing data FatekPLC_Modbus_R1 "FatekPLC_Modbus_R1" @ "Modbus" [ readStart="40001", readValueType="int16", writeStart="40001", writeValueType="int16", writeType="holding" ]
        Thing data FatekPLC_Modbus_R13 "FatekPLC_Modbus_R13" @ "Modbus" [ readStart="40013", readValueType="int16", writeStart="40013", writeValueType="int16", writeType="holding" ]
}

Log:

2018-08-02 23:48:12.388 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 1/1 error: I/O exception: IOException CRC Error in received frame: 0 bytes: . Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@18e3c53 (unit id 1 & transaction 1532). Serial parameters: SerialParameters@1873c77[portName=/dev/ttyUSB0,baudRate=115200,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=1500]
2018-08-02 23:48:12.391 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute reached max tries 1, throwing last error: I/O exception: IOException CRC Error in received frame: 0 bytes: . Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@18e3c53 (unit id 1 & transaction 1532). Serial parameters: SerialParameters@1873c77[portName=/dev/ttyUSB0,baudRate=115200,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=1500]
2018-08-02 23:48:12.395 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 3 failed when executing request (ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@2a374a[slaveId=1,functionCode=READ_MULTIPLE_REGISTERS,start=40000,length=3840,maxTries=3]). Aborting. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: IOException CRC Error in received frame: 0 bytes: [operation ID 93e1ea96-5f81-4e0f-92f4-47b892994180]
2018-08-02 23:48:12.427 [ERROR] [odbus.handler.ModbusDataThingHandler] - Thing modbus:data:fatekplcusb0:holding_R0_to_R3839:FatekPLC_Modbus_R0 ‘FatekPLC_Modbus_R0’ had ModbusSlaveIOExceptionImpl error on read: ModbusSlaveIOException(cause=ModbusIOException, EOF=false, message='I/O exception: IOException CRC Error in received frame: 0 bytes: ', cause2=null)
2018-08-02 23:48:12.435 [ERROR] [odbus.handler.ModbusDataThingHandler] - Thing modbus:data:fatekplcusb0:holding_R0_to_R3839:FatekPLC_Modbus_R1 ‘FatekPLC_Modbus_R1’ had ModbusSlaveIOExceptionImpl error on read: ModbusSlaveIOException(cause=ModbusIOException, EOF=false, message='I/O exception: IOException CRC Error in received frame: 0 bytes: ', cause2=null)
2018-08-02 23:48:12.442 [ERROR] [odbus.handler.ModbusDataThingHandler] - Thing modbus:data:fatekplcusb0:holding_R0_to_R3839:FatekPLC_Modbus_R13 ‘FatekPLC_Modbus_R13’ had ModbusSlaveIOExceptionImpl error on read: ModbusSlaveIOException(cause=ModbusIOException, EOF=false, message='I/O exception: IOException CRC Error in received frame: 0 bytes: ', cause2=null)

In the other modbus binding I had registers configured as folllows:
serial.slaveR1.connection=/dev/ttyUSB0:115200:8:none:1:rtu:150
serial.slaveR1.id=1
serial.slaveR1.start=0
serial.slaveR1.length=64
#serial.slaveR1.length=1280
serial.slaveR1.type=holding
#serial.slaveR1.valuetype=uint16

Fatek documentation:
http://www.esea.cz/support/fatek/FBs_Manual/Manual_2/Chapter_13.pdf

I would appreciate some help


(Ssalonen) #508

Hi!

Check the comment on addressing in the manual https://github.com/ssalonen/openhab2-addons/blob/modbus-openhab2-native-binding/addons/binding/org.openhab.binding.modbus/README.md#register-and-bit-addressing

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


(Виктор Данев) #509

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


(Ssalonen) #511

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)


(Виктор Данев) #512

Thank you!


(Bogumil J.) #513

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" ] {
}

(Ssalonen) #514

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


(Rossko57) #515

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)


(Rolf) #516

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


(Miika Jukka) #517

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.


(Rolf) #518

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


(Old House) #519

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.


(Miika Jukka) #520

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.


(Arndt Braun) #521

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


(Rossko57) #522

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.


(Ssalonen) #523

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/


(Łukasz Dywicki) #524

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.


(Ssalonen) #525

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