Connecting 2 OH2 Instances on separate Hosts

Hi everyone.

I have a Raspi running openhabian 2.3 for my house.

I want to install some devices in my basement that is too far from home to be reached by wifi or ethernet, so I’m thinking of using a 4G router with dedicated sim card, with another Raspi with openhabian acting as slave connected over the internet.

I know it might seem confusing, but I really need someone to point me in the right direction knowing that:

  • I need to install some devices like door sensors, lights, temperature sensors and so on
  • Basement is not reachable from home network
  • I have a 4G router with a dedicated data sim card

Any help?

1 Like

will you have strong enough mobile network signal to establish a reasonable data connection in your basement?

anyway… assuming that you can connect the 2nd OH2 system to the internet, you can use MQTT to exchange information between the 2 systems.

Read up on
optionally, you can enable: to be easier to “link” the 2 OH2 instances together

Hi Dim, thanks for replying.

So can I use MQTT putting my home opennhab public address as a broker?

What about devices working on different protocols like zigbee (hue)?

It would look like this (don’t laugh… i did this in a few seconds :slight_smile:):

Master & “Slave” by DM:


Not laughing at all, looks great.

But one thing is not clear to me.

If I have, for example, a hue light like this:

Switch	padronale_luce		"Luce Padronale"                 <light>         (padronale, luci){ channel="hue:xxxxxxxxxxxxxxxxxx:4:color" }

can I define a second channel like this in order to work with MQTT?

Switch	padronale_luce		"Luce Padronale"                 <light>         (padronale, luci){ channel="hue:xxxxxxxxxxxx:4:color" } { mqtt=">[broker:cmnd/light/POWER:command:*:default],
        <[broker:stat/light/POWER:state:default]" }

Or maybe a dummy item that changes when the hue changes through a rule?

I think we need a bit more information. Are you using Zigbee and Zwave devices primarily? If so you don’t need a separate OH server in the basement. Both of these create a mesh network and as long as devices are within 4 hops (I think) to the controller everything should work just fine. So even if your wifi doesn’t reach to the basement, so long as you have one or two zwave or zigbee devices that can reach to the basement, all the devices in the basement will route their messages through those devices.

Since Hue is Zigbee, you don’t need wifi to reach those devices. You just need enough devices to form a good mesh across the whole house. You will have to buy extra hardware anyway. You may as well spend that money buying devices that actually do something instead of extra Hue hubs, controllers, or coordinators.

However, if you are using wifi based devices then Dim’s approach is probably going to be the best. You can use CloudMQTT as your broker (there is a tutorial for how to import the CA so you can encrypt the message traffic) for the two instances of OH to reach each other. Or you can set up an OpenVPN connection between the two and they can see each other as if they were on the same network.

There is a special configuration file for MQTT named mqtt-eventbus.cfg. This can be configured to automatically publish all the events that occur on the Items on the slave to a standardized set of topics. On the master your can also configure it and those incoming events will automatically be published to the Items with the same name. Commands and updates can go both directions. There is no need to set up MQTT configs yourself, though you certainly can do it that way.

In the upcoming 2.4 version of the binding the event bus will go away but there will be an alternative approach.