Combine 2 OpenHAB installations

My question: is it possible to have 2 OpenHAB instances communicate and share data, over WAN connections without static IPs?

My use case is that I’d like to monitor things like temperature, humidity, battery voltages, etc in my campervan.

Whilst at home the van is parked close to the house so I could in theory just log straight to my internal OH instance, but this would mean I’d then lose logging and control whilst away on a trip. So I’m considering putting a dedicated OH instance in the van using a Pi, and having an internal WiFi in the van so the devices are always connected.

I’d also like to action things like enabling the mains battery charging when at home, when the battery voltage drops below a certain level, which is where I’d need the comms between the 2 instances to come in as the mains switch would be linking to my home instance.

Both the WAN connections (home - vDSL, van - 4G) have dynamic IP so I can’t create locked down open ports, nor reliable VPN configuration, so is there any way that I can have these 2 instances connect and share data?

There is a remote OH binding that will let you. add items from another OH instance. I think this might work, you will have to use on of the dynamic DNS services to get around your dynamic IP’s. However you will HAVE to either open ports or create a VPN for this to work. The data has to flow somehow.

Alternatively I do something minimal for monitoring with my persistance DB. I use AWS DynamoDB for a few items, My OH updates the DB, then I can access the DB anywhere to pull the values. I think my AWS bill for this is around 3 Cents a month. Granted this will only give you monitoring of values, it WOULD get you away from any need to open ports, or have static IP’s or any of that fun stuff.

Ok I spent an extra 2 seconds thinking about this. You CAN use this (Remote AWS DB) method to run automations.

The way you would do this is to create a custom bash/python/etc script that would regularly pull the values from the DB, then have OH execute script with the exec binding. This will give you an item to base rules on. The draw backs I see would be the granularity of the refresh would not be great. You would want to limit your pulls to every 30-60+ seconds, unless you want to have a large AWS Bill.

Use the Tailscale VPN feature in openHABian, it’ll get you fixed IPs on the VPN interface that you then can use with the remote openHAB binding.
FWIW, there’s also VPN clients for Windows and Android.

1 Like

Your home IP is less likely to change than your van’s IP, so you could set up a VPN from your van to your house, using one of the free Dynamic DNS services, and have the van connect to the home VPN. Many routers can be set to update your IP on these services when they change - I have been using for years, and it’s a built-in option on my Unifi USG for dynamic DNS.

That should eliminate one of the variables.