Connect multiple (slave) openhab instances?

Hi there,

I’ve got a main openhab installation at home.
All the data is stored in a postgres database, and use in grafana.

I now want to add two other instances, but I want to keep them slim, all the data should be collected in the main postgres database at home. They are all in the same network (VPN).

  1. Holiday House:
  • Stable internet, OH should be usable normally.
  • Data should be (additionally) forwarded to the main postgres database, doesn’t have to be kept long locally.
  1. Camper Van:
  • Unstable internet (can lose connection to the postgres database at home).
  • Maybe unstable power or local database (raspberry).
  • Data should be forwarded to the main postgres database, doesn’t have to be kept long locally.

How would you do this? So that both remote installations can work on their own, but the data is collected in the main database of my home OH? Or even things/items, etc used from my main installation?

Is Remote openHAB - Bindings | openHAB the way to go?
Should I just forward via MQTT (needs a lot of duplication for all the items on my home site)?

Since they are all on the same network, just give each OH instance’s persistence the same credentials and connection info for Postgres. Then they will all save their data to the same Postgres instance and I think the same DB.

Just be sure to use unique Items names across all three instances.

Both approaches will require duplicating the Items from your remote instances on your main OH instance. You’d only really need to do that if you have rules or UI stuff in your main OH that needs information from the remote OH instances.

Note there is MQTT Event Bus [4.0.0.0;4.9.9.9] if you need to go the MQTT route.

1 Like

Thank you very much! That sounds good.
Another question that came to my mind: On connection loss, do the in-memory or other options sync data to postgres when the connection is established again, or it’s just lost?

@rlkoshak ah I just noticed there is persistent sessions in MQTT. If this can be set through OH, then I guess the approach using an Event Bus is the one I need, wich a local MQTT server on both remote hosts, where the main OH connects to.

I don’t think so. I think the data is just lost.

I don’t think OH supports persistence connections in the MQTT binding, but it should be relativelty easy to add is someone volunteers. However the challenge will be that the timestamps will be lost. OH will save the data to PostgreSQL at the time the message was received, not when the message was originally sent.

Ah I see… okay, then I cannot seem solve my problem like this :confused: