Server and client with openhab

Hi guys,

I have my main raspberry pi which i have openhab running and some gpio pis connected.
I would like to add a second raspberry pi which will also run openhab. The second pi will be a client to the main.

I want to communicate only with the main pi and the main pi should communicate to client pi.
I dont want to have site maps on both devices.

Any advice will be appreciated.

Hi, welcome here first of all!

As for your questions, you can either use the REST API with the http binding and the JSONPATH transform, or you can set up a MQTT broker, potentially in combination with the Event bus to communicate.

One more thing that came to mind is NodeRed, but I have no experience with that whatsoever.

I hope this gives you enough pointers to get started.

Hey Roft,

Thanks for your suggestions.
I want to use the mosquitto mqtt so that the two pi can communicate among them.

How do i proceed with the mqtt?
Currently i have install openhab on both device.

You could use the mqtt2 binding and get the functionality using the rules you find here
I use something similar written in jython and it works great.

I’d recommend not to use OH on both RPis. Since one is only a “client”, why add all the overhead of a full Oh installation? For example, I’ve written to report to my OH sensor readings or to activate relays connected to RPIs GPIO pins on RPis scattered throughout my house without running a full OH installation on them.

It is WAY easier to install, configure, and keep up with having just one OH instance unless this isn’t possible.


Hi Rich,

What is the disadvantage of using OH on both RPis?

OH is relatively heavy weight and will take up more resources, which probably doesn’t matter. But it is also harder to configure to federate with another OH. You will need to use the mqtt1 binding, or wore rules using the mqtt2 binding. It’s more work over all. With a separate special purpose script it even something you would yourself it’s just a couple lines of config or scripting code.