Railduino connection with modbus TCP

Hey everyone

I am very new to openhab.
I’ve explored the items and sitemap section and everything goes very well.

Now I am trying to connect a Railduino but it is not working as I want it to :slight_smile:
I have 1 switch to control and 2 outputs.

This is what I have so far:
openhabconfig:
modbus:tcp.slave1.connection=192.168.0.184:502
modbus:tcp.slave1.type=holding

Items:
Switch Licht_gang “Licht gang” (EV) {modbus=“slave1:<1.0:>5”}
Switch Licht_badkamer “Licht badkamer” (EV) {modbus=“slave1:6”}

First of all I want to know for sure if the IP adress is correct.
Then I don’t know if the 1.0 register will work: the digital inputs on the railduino starts at 1.0 untill 3.7

I was hoping someone else allready tried the railduino units with openhab…

Thanks in advance

1 Like

So i’ve got it working - sort of -
Updated the binding to the 1.10 version SNAPSHOT

I just have to get the multiple write/read register to work.
I can only control the outputs: register 5 to 16
The inputs are multiplexed as 1.0 / 1.1 / 1.2 / 1.3 / 1.4 / 1.5 / 1.6 / 2.0 / 2.1 / …

Any help on how to get the inputs working?
Update of the

config:

modbus:poll=100
modbus:writemultipleregisters=true
modbus:tcp.slave1.connection=192.168.0.184
modbus:tcp.slave1.type=holding

Items:
Switch Licht_gang “Licht gang” (EV) {modbus=“slave1:<1:>5”}
Switch Licht_badkamer “Licht badkamer” (EV) {modbus=“slave1:6”}

Thanks

I didn’t know there were any 1.10 openhab bindings?

Have you seen the Modbus binding Wiki?


In your config you will need to specify a length (count) for register addressing, and although there is a default it always wise to specify the address.

If your inputs and outputs are of different types, you might need to configure two OH slaves to map onto your real device.

I’m not sure what is meant here. 1.0 is not a valid Modbus register address. Maybe it means register 1 bit 0 ? Bitwise operations on 16-bit holding or input registers are a bit of a pain, but can be done. Its not the best design choice, given that Modbus natively supports single bits via the coil and contact commands.

But before delving into that, you need to figure out exactly what face this railduino is presenting to the Modbus interface.

Found some Railduino documentation
http://www.sedtronic.cz/soubory/stranky/Manual-Railduino-v1.3-update-14112016-EN.pdf

Key parts -

1  IO address of the Railduino register ....
a.  the digital inputs are in the form of full bytes at the addresses 1.2.3

That is open to interpretation, but I think it means the inputs bits are packed into the low byte of the 16-bit Modbus registers 1, 2 and 3

Note that sometimes “Modbus register 1” can mean address 0, so perhaps try that if “start=1” doesn’t seem to owrk.

2.  Command - for the sensors always 3 - read holding registers

Not clear if “sensors” here is meant to include digital inputs, but lets guess it does. (it could also be that digital inputs are to be found in input registers instead)

So guessing at a binding config for the first few inputs -

modbus.cfg

modbus:poll=500
modbus:writemultipleregisters=true

modbus:tcp.railin.connection=192.168.0.184
modbus:tcp.railin.type=holding
modbus.tcp.railin.start=1
modbus.tcp.railin.length=1
modbus.tcp.railin.valuetype=bit

items file (for OH1, no idea about OH2)

Contact Railduino_DI1 “bit 0 [%s]” {modbus=“railin:0”}
Contact Railduino_DI2 “bit 1 [%s]” {modbus=“railin:1”}

Hi,

Have you gotten any further with this?

Best regards