as a OH beginner I found openhab as a great platform to handle my building technology in terms of energy savings, control & automation topics etc. A lot of things I’ve developed already successfully but with modbus I´m in a dead end…
Version is openHAB 3.4.2
ModBus TCP Slave works and with diagnosis tool I get values
Hello Chris,
welcome to the forum, always nice to see new members.
From what you posted it is hard to help you - simply to little information.
Kindly share some details:
What are you trying to achieve?
Which devices are you connecting to?
Your thing definitions (See the code tab in Main UI, use code fences when posting source code or e.g. log files)
The definition of your item
Maybe you can start step by step. First disable the related things in Main UI. then start bottom up to activate them and have a look at the log entries written. Do this bottom-up (Bridge-, Poller-, Data-Thing).
Post these parts of the log as well.
This way we have some more infomation to deal with and might be able to help you.
Are you familiar with the ModBus concept or is this your first time dealing with it?
Hi, perhaps it helps when you know my config:
Bridge: IP-address & Port:502
Poll: Bridge, Intervall, Start e.g. 1024, length e.g. 10, holding register
Data: Poll, Read Address e.g. 1028, Read Type: 16bit, channel: value as number
As this is device dependent and we do not even know about the hardware dealt with (nor the modbus registers available or the data to be read) Chris should provide his setup.
Makes no sense if e.g. I would post my setup for a certain energy meter or a relais board when the intention is to e.g. read values from a solar inverter.
So @2mad4max , kindly give us some insights and we can solve the mystery.
Hi both, thanks a lot for your instant reply and sorry for my late reply (had hard cold weekend with dog man trailing training).
So, following how and what I did bottom up:
ModBus device to get data from is a heating controller of an local heating station.
Product SCHNEID type MR12 controller with an ModBus TCP interface.
Data points range 40600 – 40900 / read only / integer (but no info which integer )/ No groups
Schneid ModBus TCP interface configuration:
a. Network modus: Ethernet with a reachable correct local IP
b. Controller address: 1
c. Datamodus: ModBus TCP (other options are TCP client or TCP server)
d. Port:2001
e. Repeat timer: 4000
f. Port: 2001
1.1 Checked with ModBus interface tool from SCHNEID (ModBus TCP interface is reachable and configurable).
1.2 Checked with ModBus Poll tool reachable and get correct data. BUT only if I ask for e.g. datapoint with 600 instead of 40600….
OH ModBus bridge:
a. Thing type: Modbus TCP slave
b. Correct local IP
c. Port: 2001
d. ID: 1
e. Discovery enabled: Disabled
f. RTU Encoding: Disabled
g. Time between transactions: 60
OH ModBus poll bridge:
h. Parent bridge: ModBus bridge (above)
i. Thing type: Regular poll
j. Poll interval: 2000
k. Start: 40600 (No matter whether 40600 or only 600 the bridge shows online)
l. Length: 5 (so 40600 shall be included)
m. Type: holding register
n. Maximum tries when reading: 3
OH ModBus data:
o. Parent bridge: ModBus poll bridge (above)
p. Thing type: ModBus data
q. Read address: 40600
r. Nothing entered regarding write because read only data required
ModBus data thing channel:
Whatever I select (Value as number, value as string) I always get “NULL” as result.
In case of the 40600 address I shall get the outside temperature but get “NULL”…
Hope the problem sits in front of the PC.
Best
Chris
I just saw your reply, been busy with other things.
I tried to get a modbus register map for your device, but I did not find it a the Schneid website.
What is crucial with modbus is to know the format of the data to be read. E.g; An Integer could be 16, 32 or 64bit, it might be a signed or unsigned value. ModBus is somehow old and usually is based on 16 bit words that are combined to larger data types by reading multiple words and interpreting the result (signed/unsigend, number of digits/fraction)
My energy meter provides the total avtive import as 64 bit unsigned value, so you need to read 4 16bit words. It is important to set the correct read value type when reading data.
(Sorry this shows a different (signed) value than in the example below)
The register map provided by the vendor is the most important part, there you see how data is provided / structured.
Your bridges look OK (btw: standard port for modbus is 502 (You use 2000, but that is your choice).
Do you have a link to the documentation of the modbus register map?
I guess that the data things are not correctly mapped to the data type in OH.
Here an example for the meter value I mentioned above (OH 4.1M4):
Data Thing:
Thankls a lot Thomas. I´ve asked the Manufacturer about having the correct ModBus table repectively interface description. Well aswer was “upps sorry there is a new one” so I wait for that and then start again. Keep you in the loop
Hi Guys, happy new year to everyone!
First I can pull modbus data using mbpoll so the Schneid Modbus interface is acceseble
I´ve got another Modbus description of the manufactor (Schneid).
Now try again following that to establish the Slave/Poll and data thing. All goes well means all “green” but still no data shown it shows “NULL”.
I´m again lost what I´m doing wrong.
Hi Holger,
Is your Schneid System an MR12 “Basis Modulregler”?
TCP/IP Interface is the Schneid Steckkartenmodul CM12-NET (Steckkarte for MR12)
I had first a CM08 but did nothing well with Modbus TCP …
Got both interfaces (Steckkarten) via my “Nahwärmeversorger” so not direct from Schneid.
Interface Config Tool is: CM-12 Konfigurationstool V1.1.3 (Schneid Webpage Downloads)
Register found somewhere goggled send me a PN
The CM12 Interface is well accesseble and delivers well data (mbPoll tool) but openHab not…
Best Chris
please post the YAML content of the “Code” Tab for the related things (Your interface,Poller and Data things). (See my previous post).
Add details on the corresponding item as well.
This might help to resolve it.
First read only a single value in the poller, currently you are polling 5 values. This will reduce the potential issues further - keep it as simple as possible in the beginning.
Did you check the log? What happens there when data gets polled? Did you set the binding into debug mode to get more detailed log information?