Join Modbus data from several slaves

Hello All,

Quick question before I dive into the subject: Would I be able to use openHAB to take the Modbus data supplied by four different slaves (4x holding registers) and make it available as one set of data under one IP address to a master that is only able to request data from one single slave?

This would be via a TCP connection.

The data is currently made available by a router that I would connect to, only the router provides the data under those four IP addresses of the four slaves, changing that set-up is not an option.

Looking forward to your replies, and thanks in advance!

Openhab can act as a Master to four Modbus-TCP slaves. Holding registers can be read in as OH Items to be stored and manipulated etc.

Openhab cannot also be a Modbus-TCP slave for some other Modbus master. Perhaps there is some other way for your “master” system to interrogate OH ? there is a REST interface provided for example.

thank you for that informative reply.

Unfortunately, my master system has got very limited interface options, only a serial connection via one port, tcp via one IP and this one: I would be able to read a combined and processed set of data from a text (or .csv) file, maybe I can use OH to produce that text file and save it to a chosen location?

It’s difficult to think of a “Modbus master” that can only poll one slave. Whatever is this device? The whole concept of Modbus is the ability to poll multiple slaves over one serial port.

If you are choosing Openhab just for this task, it is probably not the best tool, I would advise to think again. A simple PLC or Arduino with custom code should be able to do 4-into-1 work - polling 4 slaves and presenting a single virtual slave on another interface.

If you are already using Openhab for other things, then I’m sure something could be cobbled up, though it might be a fiddly job. As this Master seems to be a bit dim, it may even be possible to simulate modbus-slave behaviour in OH. It would only have to listen for a particular TCP pattern from the master, and respond with its assembled copy of the real target registers. Not as robust and flexible as a real Modbus solution, but might do the job.