I have until recently been connecting manually to the “home VPN” on the mobile when not being connected to the home network. I knew it should be possible to automate with Tasker and it turned out to be very easy.
To start with, yes I am still using OpenVPN. I have too many things automated using OpenVPN to jump ship for Wireguard as long as OpenVPN is a decent option doing what it is supposed to do.
Next thing, which Android client to use. I would say Arne Schwabe’s open source client is a good choice.
Then in Tasker you set up two new profiles, one for when you are connected to your home WiFi and one for when you are not. For the not-at-home profile you add a task “Connect VPN”, with a Task of type “Send Intent”:
Action: android.intent.action.MAIN
Extra: de.blinkt.openvpn.api.profileName:<your-vpn-profile-from-the-openvpn-client>
Package: de.blinkt.openvpn
Class: de.blinkt.openvpn.api.ConnectVPN
Target: Activity
For the at-home profile you add a task “Disconnect VPN”, with a Task of type “Send Intent”:
Action: android.intent.action.MAIN
Extra: de.blinkt.openvpn.api.profileName:<your-vpn-profile-from-the-openvpn-client>
Package: de.blinkt.openvpn
Class: de.blinkt.openvpn.api.DisconnectVPN
Target: Activity
Easy peasy, try it out with connecting and disconnecting from the home WiFi.
I can not say I use Tasker for a lot but for creating a hotspot automatically in the car (based on the bluetooth conenction to the navigator) and at my workplace (based on the geographical position), I find it very useful.