Android Home Assistant Companion connection to Home Assistant local server using a VPN tunnel

Hi,

I have installed a Home Assistant in a Rasberry Pi 5 configured to be remotely accessed via https using a “duckdns” domain.

I have installed also in my Android mobile phone the Home Assistance companion App and I can connect the App also remotely to the local HA server using https connection to the mydomain.duckdns domain as the HA local server URL.

I want HA companion connects to HA local server via a VPN tunnel.
I have installed and configured in the HA local server wireguard VPN.
I have also installed client wireguard VPN in my Android mobile phone.

I guess that if I open the VPN tunnel in the client wireguard , in the Android mobile, and after I open the HA companion and connect it to the HA local server by using https to mydomain.duckdns domain, as it is configured, this connection is not going through the VPN tunnel but outside the VPN tunnel.
In fact if I close the VPN tunnel, the connection to the HA local server remains open.

If I connect to the HA local server through a web browser, in the android mobile, by doing “https://192.168.1.X:8123…” I can connect to the HA server and this connection is closed when I close the VPN tunnel.

How should I configure the HA companion to connect to the HA local server to go through the VPN tunnel?

Regards

If you have Wiregaurd full tunnel to your home network, I am not sure you have to do anything in the HA Companion. If your Android can connect while at home, it will connect the same while outside of your home but connected to Wireguard VPN.

I have a split Wireguard tunnel and specify a few IP address to use the tunnel for items such as Home Asst, Hubitat, Plex Server, etc. I never changed anything in HA Companion.

I am not sure if HA Companion can do it but I use Tasker (~$4 and well worth the money) to connect to Wireguard split tunnel whenever not connected to home SSID.

I run WG on my Unifi system and previously ran it on a raspberry pi separate from my HA installation. Since I don’t use the Wireguard Home Assistant add-on, that could nullify everything I just typed.

Hi Stephenn,

The VPM tunnel that i have configured is just to connect to the local network where the HA server runs.

You must be right!

I have set the SSID WiFi just to be able to set the internal URL. The internal URL points to the local HA server network.

It seems that without having connected to the WIFI but opening the VPN tunnel, the HA companion connects through the VPN tunnel.

The only evidence I am able to see is that when I close the VPN tunnel, HA companion lose connection and reconnects again by using the external URL (mydomain.duckdns.org).

Every time I open or close VPN tunnel, HA companion reconnects.

I suppose that the HA companion behavior is as per design.

Thank you for your help.

Regards