I too am having an issue getting this to work. But I am a n00b.
I guess firstly, I should say that this is my first Tasker task. And I've tried to figure out how to get Logs on Tasker to diagnose my issue, but everytime I go to Run Log, it is blank with nothing there. So as of now I have no way of troubleshooting, other than the myriad of combinations I have tried to get this to work. I also don't understand some of the suggestions look like code to me, but my app seems entirely GUI, so if anyone has any tips on how to code solutions that would be appreciated too. I am using Tasker, OpenVPN Tasker Plugin, and OpenVPN for Android.
Anyways, here is what I have:
Profile named "Wifi Connected"
SSID: mywifi
MAC: blank
IP: blank
Active: Any
Invert: unchecked
Entry Task: OpenVPN VPN Connect, configuration Connect
Exit Task: OpenVPN VPN Disconnect, configuration Disconnect
What is happening:
I come into range of "mywifi" (or alternatively I just turn router on) and nothing on my phone changes. If I unlock my phone to check, the "mywifi" is connected, but the VPN is not. If I open Tasker, I can see that my profile is highlighted in green, so it must be recognizing the state right? So then if I muck around with the on/off buttons or if I close and reopen tasker, yes the VPN will eventually connect but only if I have interacted with the app in some way. I've tried various combinations of waiting for some time, closing the app manually, etc...
The same goes for disconnecting. If I go away from "mywifi" (or turn off the router), the state stops being green but OpenVPN remains connected. It will stay connected even on LTE, and then if I connect to a different Wifi afterwards, it will again remain connected. It won't disconnect unless I muck around with the various on/off buttons in Tasker or if I manually disconnect in the OpenVPN app.
If anyone could provide me any breadcrumbs as to how to figure this out?
(on a side note, I would love to get wifi-tethering to automate with Tasker too but my understanding is a root is required, which I have not done yet as I am too n00b at this stage. Unless anyone knows of a non-root alternative for that, but I will make a different post for that issue once I can work this one out) edit - found this thread
https://xdaforums.com/galaxy-s9-plus/help/automate-wifi-tether-connecting-to-t3765373 but the app doesn't offer the option of Bluetooth NEAR, it's only if Bluetooth is connected - doesn't work for me since my partner wants her phone Bluetoothed to the head unit, but my phone for the wifi tethering).
Thank you!