Connecting distributed openhab instances

I suppose both approaches are appropriate for some contexts (e.g. Hue Bulbs physically do not lend themselves to being controlled in any way except through the controller), but my personal HA philosophy is that if you have to resort to a User Interface it is an HA failure. And if you do have to resort to human interaction (e.g. triggering a garage door opener) it should be as easy or easier to trigger than the traditional non-automated way.

So, to continue the garage door opener, the automation better be as simple as pressing a button on the remote strapped to your sun visor or it is a regression. I handle this through some automation on my phone which senses when I approach the house and opens a dialog asking if I want to open the garage. BUT this doesn’t work for my wife’s iPhone so I’m still in search of a button. I’ll probably end up just replacing the ancient garage door so I can get working remotes again.

Given this, I only use my OH sitemap for debugging purposes or to have the option to set/control stuff when I’m not home. And any time we need to manually interact with something that is automated by the controller, we do so through the traditional means (e.g. flip a light switch).

So I would probably fall on the same side as you regarding whether everything should go through the controller or not.

Couldn’t agree more.

For my property’s gate I will use the same old RF remore transmitter, since it is still hanging on the keyfob, AND migrate its functionality to the controller through a node, a couple of relays and reed switches to monitor its state.

A little late to this but I have connected two instances of OpenHab 1.8 using MQTT. Though I am only in early testing the results have been encouraging.

A little background. I use Insteon for lights and garage door control. For one reason or another I have an extremely difficult time getting Insteon commands into my garage. It is very intermittent. (Yes I messed with phase connections for days and all works except the garage.) Finally I picked up a hub and put it and a RPi in my garage. On the RPi I run my “slave” OpenHab and my original OH is on a PC in my den.

Each instance has the same set of items but the master does not have Insteon bindings for those controlled by the slave and vice-versa. I tried to omit the devices that the slave really doesn’t care about but I saw Java exceptions when I did that.
Only the master has any rules defined.

I connected them via MQTT. The slave in the garage only publishes states to MQTT and subscribes to commands and conversely the master only publishes commands to MQTT and subscribes to states so I end up with this in my openhab.cfg files:
Master:

mqtt-eventbus:broker=master
mqtt-eventbus:commandPublishTopic=master/${item}/command
mqtt-eventbus:stateSubscribeTopic=slave/slaveGarage/${item}/state

Slave:

mqtt-eventbus:broker=slaveGarage
mqtt-eventbus:statePublishTopic=slave/slaveGarage/${item}/state
mqtt-eventbus:commandSubscribeTopic=master/${item}/command

I also wrote a one line script that proved very helpful in debugging these issues. Basically it subscribes to the MQTT messages but additionally time stamps them and colors them. Here it is for what it’s worth:

mosquitto_sub -t master/\#  -t slave/slaveGarage/\# -v | sed -e "s/\(master.*\)/`tput setaf 4 & tput bold`\1`tput op`/g" -e "s/\(slave.*\)/`tput setaf 1`\1`tput op`/g" -e "s/^/$(date +%F\ %T) /"

This also addresses the question I’ve seen in a variety of places asking if it is possible to bridge Insteon over TCP/IP. It does just that. However, I currently only have a small number of devices. I don’t know how well it will scale should I install 100+ Insteon devices. Time will tell I guess.

1 Like

I’m using a similar master/slave approach between a 1.8.x OH instance and an OH 2 instance. This way I can incrementally test and integrate OH2 extensions into my system.

1 Like