Modbus Binding with WAGO Controller

Hi,

I try to access my WAGO Controller through openhab 2.4, modbus and homekit.
I’ve done this in an earlier version of openhab and it worked, but with the new version of the modbus binding I
didn’t get it running :frowning:

The first step is that I can read and write Integers to the WAGO.
How can I do that ?

This is my .things config

Bridge modbus:tcp:Light [ host="192.168.0.81", port=502 ] {
  Bridge poller Licht [ start=16030, length=10, refresh=1000, type="holding" ] {
    Thing data Lichter [ readstart="16030", readValueType="uint8", 
                         writeStart="16036", writeValueType="uint8", writeType="holding" ]
  }
}

16030-16035 are States and 16036-16040 are commands to turn on the light.
To turn on a light I just need a 1 in the register, the wago controller turns on the light and turns the register to 0.

Thanks in advance
N3tw124rd

Please, format your code better and provide us your .items file.

If you are going to specify byte read type values, you also need to specify which part of the modbus register word to look at. There are examples in the docs.

It’s really going to help if you can tell us what you see in openhab.log and events.log

Hi,
this is my .items

Number test “Register 16030 [%d]” { channel=“modbus:data:Light:Licht:Test:Number”}

And this is my .things

Bridge modbus:tcp:Light [ host="192.168.0.81", port=502 ] {
  Bridge poller Licht [ start=16030, length=10, refresh=1000, type="holding" ] {
    Thing data Lichter [ readstart="16030", readValueType="uint16", 
                         writeStart="16036", writeValueType="uint16", writeType="holding" ]
    Thing data Test [ readstart="16030", readValueType="uint16" ]`
  }
}

This is what openhab.log says

Thing modbus:poller:Light:Licht received registers RegisterArrayWrappingInputRegister(00 ff 00 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00) for request ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@388a1ace[slaveId=1,functionCode=READ_MULTIPLE_REGISTERS,start=16030,length=10,maxTries=3]

So the binding can read, because ff and 18 are values which I forced in the controller.

And this is the event.log

modbus:poller:Light:Licht' changed from UNINITIALIZED to INITIALIZING
modbus:poller:Light:Licht' changed from INITIALIZING to ONLINE
modbus:data:Light:Licht:Lichter' changed from UNINITIALIZED to INITIALIZING
modbus:data:Light:Licht:Lichter' changed from INITIALIZING to OFFLINE (CONFIGURATION_ERROR)
modbus:data:Light:Licht:Test' changed from UNINITIALIZED to INITIALIZING
modbus:data:Light:Licht:Test' changed from INITIALIZING to OFFLINE (CONFIGURATION_ERROR)

So it looks like there is a configuration Error :frowning:

THX

We can see two different .things files. Which one is it? And when providing logs you should enable DEBUG. And please use code fences for configurations also as you did with events.log.

I think you don’t need two separate things for reading and writing to/from holding registers. See binding documentation once more and get yourself familiar with full examples.

The last one is the actual one.
I turned on DEBUG for the 3 important packages, but I thought that was the importantest part.
I checked the documentation several times and I always get the CONFIGURATION_ERROR :frowning:
I also tested adding a item via paperUI and this is working.
The problem is that the .json files are different to the .thing and .item files and I can’T compare them :frowning:

No they can’t be compared side by side. So the connection works as you prooved with PaperUI. Then it must be a typo in your .things file. Pick up your magnifying glass and work your way through the file and compare to docs. You’ll find it eventually :+1:

Configuration error details (reason) is shown in paper ui, have a look.

I can‘t find Anything to those configuration errors details in Paper ui.
Do i Need to turn on a Kind of Experte Mode ?

There won’t be much wrong now, nearly there.

I’m not sure you can have two data things for the same register, maybe only one works if you try.

@rossko57 It should work just fine, two data things can refer to same registers (whether it makes sense is another thing)

@n3tw124rd by browsing things you can see offline things. Open up individual things to see the details

(error text would be visible near the status)

@ssalonen: OK, but there is only written configuration_Error :frowning:
I will try from scratch…

Found the Failure…
When I switched the debugging to Trace the openhab.log tells me readStart=NULL …
The Configuration is casesensitive and I wrote readstart instead of readStart
:smile:

1 Like

Could you take screenshot of the error, might be a bug

here is a screenshot of the error :wink:

Heh, was referring to paper ui, as mentioned above, there it should show the details.

I will make a new Screenshot … One moment

1 Like

Thanks, and how does the working thing configuration look like?

I noticed you have one thing definition splitted to two lines, did you change that?

(Just to be clear, yes, parameters are case sensitive but I would have expected to see the error details there)

In the previous Screenshot you can also see the working .things File. After it was working I changed it to my belongings.
The CONFIGURATION_ERROR doesn’t show what is wrong in the configuration :frowning:
If I turned the log:level to trace the openhab.log shows that readStart is NULL and that gives me the hint :wink:

Thanks, found the issue.

It is an regression in https://github.com/openhab/openhab2-addons/pull/4304 (the thing status description is not passed to thing status updates). Shame this slipped to release version :grimacing:

UPDATE: Posted issue github: https://github.com/openhab/openhab2-addons/issues/4459