Modbus data - Configuration error

I have a problem with the “Modbus data” configuration.

Release = Raspbian GNU/Linux 10 (buster)

Kernel = Linux 4.19.58-v7+

              openHAB 2.4.0-1 (Release Build)


2019-08-16 07:13:54.380 [.ItemChannelLinkAddedEvent] - Link 'Presence_Mobile_John-network:device:192_168_4_10:online' has been added.
2019-08-16 07:13:54.400 [.ItemChannelLinkAddedEvent] - Link 'modbus_data_c3ae2668_number-modbus:data:c3ae2668:number' has been added.
2019-08-16 07:13:54.403 [.ItemChannelLinkAddedEvent] - Link 'modbus_data_c3ae2668_lastReadSuccess-modbus:data:c3ae2668:lastReadSuccess' has been added.
2019-08-16 07:13:54.409 [.ItemChannelLinkAddedEvent] - Link 'modbus_data_c3ae2668_lastWriteSuccess-modbus:data:c3ae2668:lastWriteSuccess' has been added.
2019-08-16 07:13:54.410 [.ItemChannelLinkAddedEvent] - Link 'modbus_data_c3ae2668_lastReadError-modbus:data:c3ae2668:lastReadError' has been added.
2019-08-16 07:13:54.412 [.ItemChannelLinkAddedEvent] - Link 'modbus_data_c3ae2668_lastWriteError-modbus:data:c3ae2668:lastWriteError' has been added.
2019-08-16 07:13:54.639 [hingStatusInfoChangedEvent] - 'modbus:poller:63d79035' changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)
2019-08-16 07:13:54.664 [hingStatusInfoChangedEvent] - 'modbus:data:c3ae2668' changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)
2019-08-16 07:13:54.716 [hingStatusInfoChangedEvent] - 'modbus:serial:3d753460' changed from UNINITIALIZED to INITIALIZING
2019-08-16 07:13:54.788 [hingStatusInfoChangedEvent] - 'modbus:serial:3d753460' changed from INITIALIZING to ONLINE
2019-08-16 07:13:54.814 [hingStatusInfoChangedEvent] - 'modbus:poller:63d79035' changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING
2019-08-16 07:13:54.841 [hingStatusInfoChangedEvent] - 'modbus:poller:63d79035' changed from INITIALIZING to ONLINE
2019-08-16 07:13:54.899 [hingStatusInfoChangedEvent] - 'modbus:data:c3ae2668' changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING
2019-08-16 07:13:54.930 [hingStatusInfoChangedEvent] - 'modbus:data:c3ae2668' changed from INITIALIZING to OFFLINE (CONFIGURATION_ERROR)
2019-08-16 07:13:58.775 [vent.ItemStateChangedEvent] - DoorSensor changed from NULL to CLOSED
2019-08-16 07:13:58.779 [vent.ItemStateChangedEvent] - Button changed from NULL to OPEN
2019-08-16 07:13:58.789 [vent.ItemStateChangedEvent] - LED changed from NULL to OFF
2019-08-16 07:13:58.794 [vent.ItemStateChangedEvent] - channel1 changed from NULL to OFF
2019-08-16 07:15:01.837 [me.event.ThingUpdatedEvent] - Thing 'modbus:data:c3ae2668' has been updated.

Where is the problem?
Thanks in advance

Hidden from us.

May we see the configuration of your data thing and poller thing, and perhaps a description of what you are trying to read or write?

Trying to read 10 registers.

Communication between openHab and slave is working correctly (see picture).

Same configuration (modbus):
1.Windows 10 - works fine.
2.RaspberryPi - does not work (configuration error)

I can’t find configuration files under RPI (see image)

How did you configure your Things? If it was with PaperUI, there are no special modbus files.

About the only part of your Modbus configuration that you have shown is that you have a Serial thing.
Windows has serial ports like COM1, Pi will have ports like dev/ttyUSB1, so the same configuration will never work.

Ok, step by step (Configuration in PaperUI), raspberrypi 3B+ device

  1. Modbus serial slave
    a) Serial port = / dev / ttyUSB0
    b) Id = 3
    c) baud = 115200 (n, 8.1)
    d) no parity
    e) stop bits = 1
    f) data bits = 8
    g) flow in = none
    h) flow out = none
    i) encoding = RTU
    j) Time between trans = 35
    So far it’s ok
  2. Regular poll
    a) bridge selection = Modbus serial slave
    b) poll interval = 50
    c) start = 6
    d) length = 9
    e) type = holding register
    f) maximum tries … = 3
    Ok, after confirmation, communication with the device begins.
  3. Modbus data
    a) bridge selection = regular poll
    b) Read address = 0
    c) Read value type = uint16
    after confirmation the message “configuration_error” appears

see picture

Your poller starts at address 6, reads a block of 9 registers.

Your data thing asks for address 0, which is outside of the poller’s available block.

Thanks for your help.
I thought it was offset. I changed to the same address.
He showed up “online”. But the reading in “Control” does not work

You’ll probably have to reboot or restart the binding package to get over that address error.

I don’t know what you are looking at in control. Channels may not get calculated unless linked to an Item.

It works :).
If I want to extract a single bit from the registry, how can I achieve it?

You can select single bits from a holding or input register in your data Thing.

The doc contains examples of this, see “Thing data input1502bit0 ...

If you want to write to single bits on a modbus register, that is a very different game.

Can the script (.things file) look like this:

Bridge modbus: serial: slave01 [port = “/ dev / ttyUSB0”, baud = 115200, id = 1, stopBits = “1.0”, parity = “none”, dataBits = 8, encoding = “rtu”]
Bridge poller test_di[start = 8, length = 3, refresh = 500, type = “holding”]
Thing data reg08 [readStart = “8”, readValueType = “int16”]
Thing data di0 [readStart = “10.0”, readValueType = “bit”]
Thing data di1 [readStart = “10.1”, readValueType = “bit”]
Thing data di2 [readStart = “10.2”, readValueType = “bit”]

So why configuration in PaperUI?

It’s up to you, use which you prefer, xxx.things file or PaperUI

Avoid using both or you will go mad.

suppose I want to stay with PaperUI. What file do I need to create to use register 10 bit 0? What should the content of the file look like?

Okay, just as you already used PaperUI to create modbus data things … you use PaperUI to create more modbus data things.
In the “Read address” box where you put 6 before, you put 10.0
In the “Read value type” box where you selected uint16 before, you select bit
and so on.

You can have many data things belonging to one poller thing.

You can have several poller things belonging to one serial/tcp thing.

There is no file if you do this with PaperUI.

Thank you for your response.
The reading works.
Modbus write, reports error (CONFIGURATION_ERROR)
Configuration, see picture.

That’s right, Modbus protocol does not allow you to write to individual bits in a 16-bit register.

That is why I said “If you want to write to single bits on a modbus register, that is a very different game” and then pointed you to a thread that discusses this problem and offers a workaround.

Ok, I understand that changing different bits at different times in one register, can cause problems. I used a coil. At the moment, reading and writing is working.
Thank you for your help.

If you have the choice, when programming a PLC or whatever, using the Modbus protocol purpose designed binary channels (coil, discrete) is the best idea for binary data (on/off).

I have not yet implemented coil support in my PLC.
Now I have added coil support.

When working with 1 modbus device, there is no problem with transmission. Now I have two modbus islands with addresses 2 and 3.
Unfortunately, communication stops sending data.
Packet intervals are 1.6 sec despite being set to 100 ms. (see picture)