Current (Sept, 2022) way to use 2 HA instances on one LAN

I have a situation similar to what’s described in this thread. We have a house and a barn. Over time I’ll be adding one or more storage sheds and powered (as in a power line run to them) gazebos. I already have Z-Wave, Insteon, and Broadlink IR devices in the house and Z-Wave and Broadlink in the barn. All buildings that have power are also interconnected to the network hub in the house through fiber optic cables. So they’re on the same LAN, but not the same wifi.

Previously I was using ZWaveJS2MQTT in the barn and HA in the house. That system got messed up (long story, but not likely to happen again) and I’m setting up a new one. I run HA on RPis, usually a Pi4. As I mentioned, I used ZWaveJS2MQTT in the past for the barn, but that worked for Z-Wave and I want to be able to use other protocols in the barn without having to make setup changes in the future.

The last post I’ve seen on integrating two HA instances if from 2020, so I want to check on what’s going on now, 2 years later. Part of the issue is family members that get frustrated easily with too many buttons and settings, so I want to use 2 (or more - for later) instances of HA, but have it simple for family to use.

  1. Can I set it up so if a family member, using HA on their phone, connects, one control panel can control devices on both instances? If so, is that hard to do?

  2. As an alternative to #1, can I have one primary instance of HA with other secondary ones so I can control everything on all of them through the primary? If so, what are the current good ways to do that so it’s seamless and, to a user, looks like it’s all part of one system?

1 Like

Following along because I just created a second HA environment and I’m not 100% sure what I’m going to do with it (besides be a completely redundant backup).

I too have been wondering on the best approach to having two on the same network.

I have two instances perfectly working together between my home and a cabin a few hours away.
I am using the Remote Home-Assistant component found in HACS.

It should work just fine in the same LAN.

3 Likes

Does it appear, on the web interface and cell app, like one instance?

Yes. You can see and operate the entities you choose from the “remote” instance to the local one.

That looks pretty good. How hard was it to set up and how long did it take?

Very easy. Instructions are clear. I say it takes about 15 minutes to setup. All takes place in the integration. Nothing needs to change in your YAML files (other than one entry in configuration.yaml)

1 Like

Thanks!

I was seriously considering switching to another system to replace HA, for several reasons, but gave up on it because I found I’d have to configure Insteon by hand - and first I’d have to set up udev rules because needed device nodes were being created without the right permissions. By the time I finished looking at all the needed steps (even more than I mentioned here), I was ready to give up. I’ve done and can do all the things required, but sometimes you just get tired of having to spend so much time doing things that really should be automated. It just hit me that I’ve been spending decades doing that kind of stuff and my point is a good working system - not another hobby system.

Looking for this. The page you linked to doesn’t have instructions, or am I reading it wrong? So I went to this page and it looks like I can install from the store or by copying the directory to the custom_components_folder.

I can’t find it under Integrations or under Add-Ons and I can’t find anything clear on copying files into the HA system. (I’m using a Pi, so it’s HAOS, and it’s rather hard to copy anything over from in HAOS.)

Okay, got it. I had not heard of HACS before. It’s the Home Assistant Community Store. It’s not for Add-Ons, it’s more advanced and has integrations.

To get started with adding and configuring it, look here. That’s the start with downloading it. The links for the next page take you to configuring and setting it up. From there, I had to restart, go to HACS, pick the “Go to…” button to go to HACS, pick the blue button at the lower left, then search (in Integrations) for “remote” and it found Remote Home Assistant (can’t remember if that was the exact name). I had to download it, then, in a separate step, add it as an integration.

Do that on both the primary and secondary.

It also provides instructions to set up the connection. So far, I’m running into problems, since the primary isn’t connecting to the remote/secondary, even though I’ve created and copied a token. It turns out I got the screen that asks if I’m setting it up as a client or server and, somehow, I either didn’t see that screen on the client, or it came up and I hit the wrong mouse button or key before I realized it and it went away. To get this fixed, I had to delete the Remote Home Assistant custom component on the client/remote instance. That too some messing around, but I got rid of it and re-installed Remote Home Assistant again and was able to specify to work as a client.

I copied and pasted the part from the instructions that needs to go in the client’s configuration.yaml and put that in. I got an authorization token by creating one in the client system and pasted it into the configuration window for the primary system.

That’s where the good luck stops - and I’ve been fussing with this for a few hours. I specify the name of the secondary server, the port, and paste in the authorization token. I pick Secure and SSL options and click on SUBMIT. This is where things always go wrong.

My LAN uses arda.ea for the domain and I have most of my systems, including smaller ones on RPis using static IPs with hostnames. The one for the main instance is “imladris” and the one for the remote system is “lothlorien.” When I specify, for the remote system, “lothlorien,” and click SUBMIT, it takes a while, then says “Failed to connect to server.” If I use the IP address on my LAN for that same system, I get the same error immediately. If I add the domain info so I use lothlorien.arda.ea for the remote system, I also get the same error immediately.

I’ve made sure I use an authorization token from the client system, checked the port, the hostname, and have tried this with Secure and Verify SSL checked and unchecked - in all 4 possible ways to do that. I just cannot get the main system to connect to the remote one. (And, while testing, I can reach the remote system with no trouble in m browser.) I’ve tried to look for a better error in the logs, but I can’t find any set of logs that gives me information on what this plugin is doing.

  1. It’s not Autumn in the southern hemisphere
  2. Other than the USA (and maybe some wanna-be’s), we don’t call it ‘Fall’

:wink:

Okay, changed it.

What can I say? Oh, I know: “Oops!”

At this point, I have to say I think Remote Home Assistant is a poor choice. I get that it works well for some, but I have spent 2 nights with almost no sleep trying to get it to work and it won’t work. I’ve even taken to retrying by writing out new HA images for my RPi remote assistance and retrying it multiple times. It’s almost impossible to get the dialog from RHA to specify that I want that system to be a remote system instead of the main one.

I’ve followed the directions closely and even tried many variations, but for some reason, even with only a few pieces of info required for the config dialog in the main instance, I cannot get the two instances of HA to connect.

Details on the connection - on the main HA instance, when I install RHA, I need to restart HA (as directed when it’s added as an integration). Then when I go to RHA, I get a config dialog. It asks for the address of the remote system, the port (8123, as with regular HA access), and an authorization token. I’ve created a token on the remote system and copied and pasted it into my notes. So I paste it into the configuration dialog where it’s asked for. There are 2 checkboxes, one for “Secure” and one for “Verify SSL.” I’ve tried these two in all 4 possible combinations and I still get a short, useless “Failed to connect to server” message.

If it worked, it’d be a quick and simple setup - but for some reason, it just won’t connect.

I’m looking at MQTT as a solution and I’m wondering if it’s possible, in the HA mobile app, and on browsers, if there’s a way to include controls for two different servers on a Lovelace panel.

The part I am getting confused about here, is that it doesn’t exactly sound like you are following the instructions at all.

The instructions on the page say that you need to add

remote_homeassistant:
  instances:

to the remote instance configuration.yaml

The config flow (add integration) is only done on the LOCAL / master instance.

As for the terminology - I’d consider all the remote instances to be called the server, and the main home assistant instance to be the client, because the main instance is connecting TO the remote assistances, not the other way around.

Good point. Yes, I did add that. (Sorry - been working on this most of last night and tonight - I’m getting a bit blurred!)
I was not clear if, for the remote instance, I was supposed to do something to mark it as remote. I did, on one attempted install, get a dialog where I could pick if it was a remote system or not.

Remote as server - okay, I see. I was thinking of the main as a server because the server always seems to be the system in control or more at the “center” of things.

It’s much like the way ESP Home works. The ESP Home devices are actually the server, because they are waiting for the connection FROM the main instance, they would be the client if they were the ones that initiated the connection TO the main instance.

Because the access token for the remote instance is provided to the main / master / local instance, then that is the client, because it is connecting TO the remote instances.

It seems that by not including any instances in the configuration.yaml of the remote instance, that is how it knows it is the server - because it has not been given any IP address / domain names to connect to.

Makes sense.

In the first few trials, I was adding that after downloading RHA, but then I started adding that to configuration.yaml as the first step. Not only so I wouldn’t forget, but so the integration would see that in there from the start, since I don’t know when it sees that and needs it.

I figured, like you, that may have passed on the info it was a remote, but I also wondered about that, since I did, once, see the dialog that asked if I was on a remote system or not.

Right the next thing we need to look at is why thing won’t connect.

How do you have your Home Assistant instances set up? Are they on port 8123, is port 8123 using SSL or is it unsecured (which is recommended, you should be using the Nginx Proxy addon for SSL really).

I’m not sure what it was that made it work. I had to do another reinstall due to Z-Wave issues. I talked to people on the Discord Z-Wave channel for HA and it appears there’s a bug in the USB discovery that I’ve been encountering. So that led to more tests.

Then I got a good install that worked with Z-Wave, this time using MQTT. Anyway, went through test installs with that, then started working on this again.

I found a few issue that may come down to timing. For example, when I first put Remote Home Assistant on the remote system, when I went back to HACS, it told me to restart so I could configure it. If I restarted, then the only thing I could do with Configure for the RHA integration was to give it the parameters the main system needed. I went through this several times, deleting the RHA directories then removing it through HACS. When I’d go to Integrations and search, RHA would not show up.

But then, one time, I downloaded RHA and made a trip to the kitchen for a snack and got back and tried to add it again. This time it did add and gave me the dialog letting me pick if I wanted to use that system as a remote system. So timing - maybe it takes time after it downloads to do some self configuring or something else. I don’t know. I just know that the one time I added it through HACS and then let it wait 5-10 minutes and came back was the first time I saw it available as an integration when I wanted to add it.

Once I got that dialog (about whether it was a remote system or not), and I made my selection, I went to the main system. I tried connecting again, using the right system name on my LAN, the right port (8123) and pasting in the authorization token and it didn’t connect. I thought it over, rechecked everything and re-copied the authorization from my note file, and this time it worked.

So I think it may take time for some things to be set up before the integration is ready to be added (before HA is restarted), and I think it may take time for the configuration on the remote system to fully start. Also, I think I may have had a problem with copying and pasting the keys. It may be critical to make sure, when copying and pasting tokens, to make sure that a linefeed or carriage return at the start or end of the token is not copied.