HomeAssistent and homes on different locations

I have a hollidayhome and primary home in different ends of Europe. Both have some smartdevices and is connected together with lan2lan vpn. I want to manage both locations in the same instance of HomeAssistent.

Unfortunately it seems like multiple homes is not supported by homeassistant. I can define the locations as different zones, but I find some limitations:

  • There are no connection between areas and zones. As a (dirty?) workaround i can use prefix but it is not smoth.
  • Sunrise/-fall-plugin only use one location (but it is unclear for me which one of the zones is used)

Are there any functions in Homeassistent related to multiples homes or is the support for multihome more or less not existing?

Hello!
I personally have never tried if it works or not, but I have heard about people using this successfully:

Good luck and let me know if it works or not :slight_smile:

Regards!
Botond

I have used Remote Home Assistant successfully, to pull in the sensors from our second home. It works well for monitoring but it is one-way - you can see all the data and you can use it to trigger actions locally but you cannot trigger actions at the remote (secondary) location from the primary location. It also does not expose any video you may have integrated in the remote location (at least I could not get it to work). If you only want to monitor a remote location and use that data in local automations it works great.

What I found that is best for me is to take advantage of a feature in my Samsung Note 10+. This model as well as some others allow you to have separate profiles for personal vs work apps. With this feature I have 2 separate HA Mobile apps installed, one for our primary home and another one for our second home. The beauty is it exposes all the same info to HA so things like location data, battery, etc are all available. Bonus is I can also see my cameras in the mobile apps. I currently have security cameras integrated in my HA at each location that I display in each locations respective mobile app. This has been my standard way of working for ~1 year.

I have seen some comments that imply that you can have multiple homes in the HA App for the iPhone but I am not in the Apple universe so I cannot add more that that.

Thanks; for several reasons I dont want to set up a separate HA-instance in my secodary home but link everything (throught vpn) to my primary installation.

Y

Anyway,
Are there any way to get the sunrise/sunfall state for all defined zones, and not only for ā€œHomeā€?

I have a similar situation with two homes and a single instance managing both. It took a while to figure out the setup, but the general idea is to have a tunnel that acts as if home assistant had a network interface on the other network. It can then detect devices as if it was on its network.

I’ve put a openvpn server en raspberry pi in the other location and configured it to use tap. The server running home assistant has openvpn installed and connects to the server. There’s a setting to add in home assistant to make sure both network interfaces are used.

Let me know if you’re interested in more detail

6 Likes

Hey, I’d like to know more about how you set your network up, I didn’t see an option to message you directly, you can pm or just respond to this if you’re good with it. Thanks!

It’s been a while but I’ll try to explain as much as my memory serve me.

I’m currently managing 4 locations under one HA app. I don’t have anything crazy. I only have a few switches in each location.

My setup contains a main server at the primary location running docker. I use a free DNS service with my Asus Router. You can use Afraid DNS if your router isn’t equipped with that service. Next, open the ports on the router for the MQTT client to communicate with Home Assistant MQTT server. Once you have established an MQTT communication remotely, then you can add switches, sensors, or what have you from anywhere in the world. Just make sure to setup SSL certificate to secure your connection. You definitely don’t want people to sniff your package and control your device.

Look on the forums for the python script set state,
Here is the latest version from the author

https://raw.githubusercontent.com/rodpayne/home-assistant/main/.homeassistant/python_scripts/set_state.py

Create an automation on your phone device tracker that says when state is zone Home2, run set state to update person.you to ā€˜home’
Personally i think using one ha for multiple buildings is not ideal unless you are tracking area occupancy

I just use this because i run a cloud HA for all cloud connected integrations and just want my phone updating one HA, i then sync each entity that’s relevent at each physical building with remote home assistant.
This will still do what you want


description: ""
trigger:
  - platform: state
    entity_id:
      - device_tracker.phone
condition:
  - condition: state
    entity_id: device_tracker.phone
    state: Home2
action:
  - service: python_script.set_state
    data:
      entity_id: person.you
      state: home
mode: single

It"s probably a bit late now, but it may be useful to someone eventually.

I’m using OpenVPN to have a tunnel (layer 2 I think) between the two locations. Client should be where HA is, server should be in the other location. Previously, when I was running HA in docker, I would use the following configuration on the server side:

port 1195

proto udp
dev tap0

ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/jupiter.crt
key /etc/openvpn/keys/jupiter.key
dh /etc/openvpn/keys/dh.pem
tls-auth /etc/openvpn/keys/ta.key 0
tls-server

server-bridge 192.168.2.1 255.255.255.0 192.168.2.3 192.168.2.4

keepalive 10 120

;cipher AES-256-CBC

comp-lzo adaptive

user nobody
group nobody

and for the client side:

remote dns_name_to_server server_port

client
proto udp
dev tap0

ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/tunnel.crt
key /etc/openvpn/keys/tunnel.key
tls-auth /etc/openvpn/keys/ta.key 1
tls-client

ifconfig 192.168.2.3 255.255.255.0

keepalive 10 120
;cipher AES-256-CBC 
comp-lzo
persist-key
persist-tun
resolv-retry infinite
verb 3

Some comments about this config:

  • you obviously need to put the server public IP and port, and manage any firewall /router related topics to port forward / open ports
  • using tap (rather than tun) is acting as if you had a physical cable linking HA to the other location. tun is possible too, but requires to setup routing and discovery doesn’t work well unless you put some kind of multicast proxy, which I never got to work
  • it’s better to use UDP rather than TCP (the proto command) for reasons I only partially understand
  • in the docker setup, you need the ifconfig / server-bridge command to set the IP of the tunnel on the other network (where the OpenVPN server is / where the HA server is not). I’ve now move to HAOS in a VM, configured the OpenVPN client on the host and pass through the interface to the VM, so I removed those two commands and setup the IP in HA’s configuration
  • in both cases, also in HA’s network configuration, you need to uncheck auto-configure and select the network interfaces (otherwise it just takes the first one)
  • with this, the HA web interface will be accessible from both networks and it can access/discover devices on both networks
  • dev tap0 on the server allows to have a fixed tap device, but you may as well put dev tap (it’s maybe implicit with proto udp) if you don’t need to reference the device

Hope it helps someone!