VPN auto connect in new networks?

I’m completely ignorant about shortcuts. Trying to find out if it would be possible to have one auto connect Proton VPN?, whenever I try connecting to a new network on iOS 17.1.
Edit to add. I got it to connect automatically when going from cellular to WiFi. Now I just need it to not connect when is my home network.

Create 2 shortcuts:

  1. Connect VPN shortcut: Use ‘Set VPN’ to ‘Connect’ to ‘Proton’ VPN

  2. Disconnect VPN shortcut: Use ‘Set VPN’ to ‘Disconnect’ to ‘Proton’ VPN

Then create 2 automations:

  1. When disconnected to wi-fi, run connect VPN shortcut: Choose ‘Wi-fi’ → choose your wifi network(s) → check ‘Network Left’ → check ‘Run Immediately’ → choose Connect VPN shortcut

  2. When connected to wi-fi, run disconnect VPN shortcut: Similar to 1) but reverse the procedure.

I just got this to run, thanks to the help of u/saibot0224


I think I’m getting too old for this… lol. Can’t figure out where to get the “check network left” This is the one I got to work to connect to any other WiFi out of the home network. Now I just need it to disconnect when leaving any other WiFi.

When you open the Shorcuts app, there are three tabs at the bottom portion of the home screen: Shortcuts, Automation, and Gallery. Go to the Automation tab and you will see what I described in the 2 automations part of my reply. You’ll see there the ‘Network Left’ (opposite of ‘Network Joined’).

K. Got it to work. But not when the phone is locked. The automation runs, but the change won’t happen. Created two sets, one set directing to the specific VPN service and one just directing to the VPN setting. The only difference between the two, one has the VPN service specific icon (Proton) and the other has the phone settings icon. running the sets one at time. Settings icon set connect and disconnect work as expected with the phone unlocked. Turned that automation off and tried the other one and it also only works with the phone unlocked. Privacy set to allow to run when locked.
Going to check if I can run the VPN without having to have the app installed, without limiting it to just one server.

Thanks for your help.

Check if ‘allow running when locked’ is enabled (long press the shortcut icon → details → privacy → allow running when locked)

It is, and when I keep the screen on but locked, I see the automation running. I wait a bit and unlock it, to find the automation change didn’t happen. So if the disconnect run, it would still be connected and if the connect runs, it wouldn’t be connected.