Error configure modbus data - WellPro WP8026ADAM - Help please!

Hi everyone! I’m new in the forum.
A few weeks ago I bought a raspberry and OH installer. I’m testing with modbus rtu and a 16-input module.
I have a problem when I want to configure the read data.
I have managed to read one bit but my intention is to read 2 bytes.
When I configure modbus.data to read “Read Value Type int16” I get this error: Thing modbus: data: 5b885192e4: 68781dccb5 invalid readValueType: Only readValueType = ‘bit’ (or undefined) supported with coils or discrete inputs. Value type was: int16

I am attaching my confinguration and the manual for the 16-input module.

MODBUS SERIAL:

UID: modbus:serial:0fc829740d
label: ID1
thingTypeUID: modbus:serial
configuration:
  baud: 9600
  timeBetweenTransactionsMillis: 35
  connectMaxTries: 1
  stopBits: "1.0"
  parity: none
  receiveTimeoutMillis: 1500
  dataBits: 8
  echo: false
  encoding: rtu
  flowControlIn: none
  port: /dev/ttyUSB0
  flowControlOut: none
  connectTimeoutMillis: 10000
  id: 1
  enableDiscovery: false

MODBUS POLLER:

UID: modbus:poller:0fc829740d:5b885192e4
label: ID1
thingTypeUID: modbus:poller
configuration:
  start: 0
  length: 16
  refresh: 100
  maxTries: 3
  cacheMillis: 50
  type: discrete
bridgeUID: modbus:serial:0fc829740d

MODBUS DATA:

UID: modbus:data:5b885192e4:68781dccb5
label: ID1
thingTypeUID: modbus:data
configuration:
  readValueType: int16
  readTransform: default
  writeTransform: default
  readStart: "0"
  updateUnchangedValuesEveryMillis: 1000
  writeMultipleEvenWithSingleRegisterOrCoil: false
  writeMaxTries: 3
bridgeUID: modbus:poller:0fc829740d:5b885192e4

Very grateful for any help.

There are no “easy” Modbus configurations.

Here’s part of my own config for a Wellpro 8026

Bridge modbus:tcp:sv31 [ host="192.168.1.11", port=502, id=31, connectMaxTries=2, reconnectAfterMillis=600000 ] {
/* DigiIO 31 Alarm interface 16-in (Wellpro 8026) */
    Bridge poller io31_dis [ start=0, length=16, refresh=800, type="discrete" ] {
        Thing data io31_in01 [ readStart="0", readValueType="bit", updateUnchangedValuesEveryMillis=600000 ]
        Thing data io31_in02 [ readStart="1", readValueType="bit", updateUnchangedValuesEveryMillis=600000 ] /* U1 end roller */
        Thing data ...

The way to approach this is in stages.

Define your Bridge for the physical pathway (mine is via a TCP gateway, yours is real serial)

Define your poller for what you want to read from the device.
I chose to read a block of discrete bits, because that’s what the device offers us.

Define your data Things for how to interpret parts of that block.
But remember - they are discrete bits here - they simply are not 16-bit numbers.
So my data Things treat them as bits.

I then go on to link these data Things to Contact Item types in my case, Switch Items are commonly used too. If you must have them as a Number, link your bit data Thing to a Number type Item - I think you’ll get 0/1.

But the point is that you got what you asked for - 16 individual bits, not bytes.

No idea why you want to do that, but the binding will not combine ‘discrete’ bits for you.
Link bits to 16 Items and combine in a rule.

Hi Rossko57! Thank you very much for your comment.
The reason why I want to do it is because the logic of the program is not done in Openhab. I want to have an integer variable to send to another device.
I understand what it says, but I don’t know where I can choose the option to read individual 16 bits.
I can create modbus data for each bit but I have 6 16-input devices and I can go crazy.
Also, all things I create through the interface (not code).

Thank you very much again.

Well, I’ve shown you mine. You link 16 data Things to 16 openHAB Items. Then in a rule, you can combine 8 or 16 at a time to generate an integer or two. You’d need to think about just when to run the rule carefully; otherwise you’ll get some bits from one poll cycle and some from another, not all the Items update at the same instant.

Yes.

Because this is all external to openHAB, it might be easier overall to have some little external python script or some such use a Modbus library to read-poll and access the bytes at the raw protocol level, for forwarding to wherever.

It’s unfortunate the Wellpro doesn’t provide an image of its binary inputs in a 16-bit register, like more sophisticated devices sometimes do.

Yes, it is unfortunate. I have to do it bit by bit.

Thank you very much for your help.

By the way, I was left with a question:

Define your Bridge for the physical pathway (mine is via a TCP gateway, yours is real serial)

How can you use a WellPro module by modbus TCP?

Are you using a serial gateway ModbusRTU to
ModbusTCP?

Do you need to install something in OH?

Yes, a physical gateway with hardwired ethernet and RS485. There are WiFi versions available. The gateway firmware converts Modbus-TCP to/from Modbus-RTU, so the serial slave “looks like” a TCP slave to openHAB.

Actually I’ve several such gateways scattered around a large warehouse building, each serving two or three modbus devices.

This example is the exact opposite of what you’re trying to do, but the rule technique building a register from bits might be of use.