Wireguard VPN (WiFi and Mobile)

by Robert Dries

Version 7 (March 31, 2026)

Download (108 downloads)

This is a flow, which activates Wireguard when you are connected to wifi, but not your home-wifi-networks and makes sure you have a valid VPN IP after the automatic 24h disconnection of your internet provider.

It also activates Wireguard as long as you are connected to mobile data, for example you are in a not trustworthy country like China, Russia, etc..

Problem:
VPN with Wireguard loses connection after the typical 24h disconnection of your dynamic public VPN IP, because once Wireguard is activated it only knows the "old" IP of your VPN.

Solution:
Every minute the internet connection gets tested if there is VPN activated. If the ping fails, VPN gets disconnected and connected again. Hence, it makes sure to have a valid VPN IP.

Customize Flow:
1. Set Variable Names
1.a Set Tunnel Name
1.b Set wifi-SSID where you want Wireguard to be deactivated.
2. Activate remote controls in Wireguard Settings.
3. long press app icon > App Info > Battery > set to Unrestricted (on newer android: App Info > App Battery Usage > Allow Background Usage > turn ON and then click text > Unrestricted). Do this for Automate and Wireguard apps.
4. Automate > Settings > Privileges: enable "Control Wireguard tunnels".
5. Automate > Settings > Run on system startup > Enable

Cheers,
Robert

5.0 average rating from 1 reviews

5 stars
1
4 stars
0
3 stars
0
2 stars
0
1 star
0
Reports
0

Rate and review within the app in the Community section.