Toggle WireGuard based on home WiFi connection

by zilexa 0

Version 6 (September 21, 2022)

Download (8,770 downloads)

***UPDATED 2022/09/21***Tested on Android 12*After every Automate app update a reboot is required and manually verify the flow is running, this is how Automate works.*
This update should have a more robust flow, the old version worked a few days then became less reliable. Not sure why. The logic is now much better. But I am no Automate expert.
***WHAT IT DOES***
Wait for mobile network connection. If connected, test actual internet connection (ping, to capture the situation you enter an elevator when leaving home), if successful, connect to your VPN server. Then wait for home WiFi connection. If connected to home WiFi, disconnect from VPN and start over, waiting for mobile connection.
This means it will not autoconnect if you switch from home wifi directly to another wifi network. It will keep waiting for mobile connection. With that exception, I believe it should always work..
***HOW TO USE***
To use: long press app icon > App Info > Battery > set to Unrestricted. Do this for Automate and Wireguard apps.
Then in Automate
1) Go to Community in the menu and search for "WiFi toggle Wireguard", find and import this flow.
2) In Automate go to Settings > Privileges: enable "Control Wireguard tunnels".
3) Go to Flows > open this Flow > bottom right corner > edit flow.
4) Change "Obelix" to your own wifi name in block #12.
5) Change "ObelixDNS" to your wireguard tunnel name in blocks 15 and 16.

Hit Start.
Remember to reboot phone after each Automate app update and open Automate. That's an Automate requirement.

4.2 average rating from 17 reviews

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

Rate and review within the app in the Community section.