My boring Blog

Mauro Frigerio blog

Secondary home management experience with Home Assistant

22-07-2022 4 min read Article

TL;DR

Taking advantage of the unofficial integration I connect two instances of Home Assistant to each other. Thanks to the Wireguard addons I am able to avoid the fact that the 4G modem does not have a public IP address.

Intro

Due to the 2G shutdown in Switzerland, I had to change the heating management system of the second house in the mountains. After some attempts for more than a year a working and resilient solution has been in operation. I had already described some attempts in previous posts, here I collect the experience after more than a year of operation.

Structure

I have one instance of Home Assistant (HA) in my primary home, this is the only instance I connect to to manage everything. I have a second instance of HA on a Raspberry in the secondary house, internet is provided by a 4G modem that has a non-public IP address.

The secondary instance is independent and reasons on its own, but it sends all the information to the primary instance from that you can directly control everything.

Wireguard

First we need a bidirectional link between the two HA instances. The Wireguard addons allow me to create a tunnel between the secondary instance and my main router. If you do not have a router with the VPN Wireguard you can make the direct connection between the two HA instances.

If you want, you can terminate here, because the secondary home is reachable through the network. However, one has to keep making the “jump” between instances.

Unofficial component

The unofficial Remote Home-Assistant component allows multiple HA instances to be linked together. Previously you had to install the component only on the master instance, now you have to install it on all of them.

Thanks to the component you can integrate into the master instance everything that is on the other linked HAs, as if the entities, automations, etc. etc., were locally on the master. One can also choose to bring back only what one is interested in. So you have to connect to the master instance by phone or via the Web and you can run command controls without having to “jump” back and forth between instances.

Resilience (Watchdog and remote control Home Assistant)

The second house is in the mountains a few hours away, so it is not always convenient if there are problems with HA. Therefore, I wanted to add a “backdoor” in case the VPN or component failed.

I implemented in HA a kind of Watchdog and some basic commands in case of need. In both cases the operation is always the same: HA regularly checks a JSON file uploaded to a site (Dropbox, Google Drive, or any freely accessible Internet site). Based on the parameters in the file it performs a restart, or executes the requested command.

Of course, the system works only when there is an Internet connection.

Alternative

Setting up such a system is not easy and requires some network knowledge. On the other hand, if you are neglected I recommend you to subscribe to Home Assistant Cloud, currently (22.7.2022) there is a 30-day trial available and then a monthly subscription of $6.50 or $65 yearly. So Home Assistant developers take care of all the technical details for you and help HA future development.

Conclusion

I prefer to directly and personally manage access to the various instances of HA. I still contribute financially to the development of HA.

The solution described above has proved to be very stable and during more than a year of operation I have had no problems. Even the continuous upgrades of HA, addons, …, have not caused any difficulties. After a brief loss of connection due to installation and reboot, HA always reconnected to the master and was remotely controllable, even when the internet connection or power went out.

The solution proved so stable that I never had to use the “backdoor.”