Suggestions how to correlate or present data from several Openhab instances

I wrote and use MQTT 2.5 Event Bus for just this purpose. As Sebastian suggests you could use Cloud MQTT or the like, or you could set up a VPN between the hosts and configure a locally hosted broker. One nice thing about this approach is the code has already been written for you. If you are using Jython all you have to do is tag the Items you want to share. If Rules DSL you just need to add them to the right Groups.

Each individual OH instance would still be able to operate independently when the VPN is down, it’ll just generate errors in the logs which you could filter out if required when the connection is lost. With the LWT messages you get the added bonus of knowing when that network connection is lost.

I’d recommend setting up the VPN too so that you can do some minor remote administration of the machines as well.

I’m working on a more native approach that uses JavaScript NGRE Rule Templates and just the openHAB REST API but they are not fully written/tested yet. In this case you can trigger a Rule on all Item events and then publish the commands or updates to another OH instance This would have the advantage of working through myopenhab.org, though, assuming each instance has it’s own account. However, this approach gets complicated when you have more than two instances. There is no way to trigger a Rule this way in Rules DSL.

For OH 3 they are talking about creating a binding, though there is no timeline yet.

In all the cases, you have to be careful to avoid infinite loops. In your consolidation instance, it one sends commands to the remote instances and only receives updates from the remote instances (use autoupdate=false on the consolidation instance too). That way you avoid a loop where you send a command which results in an update which comes back and gets republished back to the remote and so on forever.

2 Likes