Please make us understand how you connect to modbus!
You say you have “Openhab with KNX”! What does that have to do with Modbus? If you connect ModBUS through KNX, then this is a different story!
For Modbus configurations, take a look here!
Right now I try to add in one single Device via TCP / Modbus.
The device has network and a static ip. And via this ip I want to query the data like mentioned.
The ip is pingable. But querying should be via modbus.
It should definitely work! Take a look at the link posted by me! The binding documentation is self explanatory (I have worked with Modbus and for me the documentation has been enough)!
For modbus specific questions check on the search sites on Modbus forums!
The documentation of the modbus binding assumes that you know your modbus connection point (which is normal for any connections in any binding).
I don’t think I can help you if you do not know your setup, and for sure I know less than you about the setup!
Ok, well lets take an example to read “Total AC active power” into OpenHAB.
The documentation tells us that can be found at register number 40008.
Modbus standard tells that register numbers in the 4xxxx range are of type holding, we will need that info.
But OH Modbus binding doesn’t use register numbers, it uses addresses. The doc gives that reg number 40008 is addressed at 0007, so we’ll need that info.
Modbus registers are 16-bit units, but they might represent signed or unsigned numbers, individual bits, or taken in pairs to givea 32-bit number, etc.
The doc tells us register 40008 has a range of -32768 to +32767. That tells us this register is to be treated as a signed 16-bit integer, more info we will need.
Earlier you told us the device was TCP, we need the IP address but your document does not tell us anything about that. Earlier you said you knew this IP, so another bit of info we need.
Something we do not know is the Modbus slave device ID (this a number between 1 to 247). This is important for Modbus over serial, but for many TCP devices it is defaulted to a value of 1. Your document does not tell us anything about that, maybe another doc does, but let’s guess it is 1.
You haven’t said if you want to use the old 1.x binding version, or try the new 2.x version, buts let’s guess you are going with 1.x as you have tried it already.
Here we have defined a virtual Modbus slave called neostore1, mapped to part of your real device.
It is a TCP device at port 502 and with a slave ID of 1.
We will read a block holding registers at each poll starting at address 007, and the length of the block we will read is just 1.
We will interpret the register(s) as a signed 16-bit number.
Okay, so now we have to associate an OpenHAB Item with the modbus slave.
Number MyPower "My Power x 0.01kW [%d]" {modbus="neostore1:0"}
Here we have defined a number Item that takes its value from the first element of slave neostore1.
Get that working first, and later we can work out how to transform the integer value read in units of 0.01kW (from your documentation) and scale it into decimal kW (i.e divide by 100)
Hey Rossko57,
thanks a lot for the long manual. But it still does not work
I replaced the ip because I use public IPs for this stuff right now…
I do not have any more documentation than that single pdf-file…
I did everything as you wrote, and it seems to work partly. If i insert another – wrong – ip-adress the errors have one more line like error connecting…
If I recall correctly the modbus 1.x binding log messages are sometimes missing important information (version 1.x binding: 1 & 2; vs; version 2.x binding: 1 & 2)