OpenVPN 3.0.X - Connect and Disconnect with Tasker (Solution)

Search This thread

mmotti

Senior Member
Nov 11, 2014
683
586
Hello,

I am using Automate its pretty much the same in terms of use like tasker.
But it's free and you Programm flows. But when I try this without using the back back option the disconnect interface didn't close it self.
Did you comment something new in the action blocks?

Gesendet von meinem G8341 mit Tapatalk
I didn't make any changes other than removing the 'go home' option.

Are you on OpenVPN Connect version 3.0.4?
 

mmotti

Senior Member
Nov 11, 2014
683
586
Jep running 3.0.4.
I thought it would be a little bit more slim and sexy if it works silent in the background.

Gesendet von meinem G8341 mit Tapatalk
That's odd. Perhaps automate sends the intents different to Tasker? I haven't personally used it.

Edit: have you got 'Shortcut Minimise' enabled in OpenVPN settings?
 

Nicefff

Member
Apr 21, 2018
5
0
A3000

Hi guys ,,
Where can I find lenovo A3000 h firmware , build number: a3000_a422_000_006_130517_ww_call_eng?
I really need it ..
Build number : a3000_a422_000_006_130517_ww_call_eng

Please
 

mjones73

Senior Member
Apr 5, 2010
3,577
927
North East, MD
I made these changes to my OpenVPN set up and it attempts to connect, crashes and goes into a loop when Tasker runs the action to connect. Connecting manually through the app works fine. Any suggestions on what to check?

Edit: Nevermind, looking at my Tasker logs, it's firing the disconnect right after the connect, I'll figure out what I broke...
 
Last edited:

wiz561

Senior Member
Apr 16, 2011
63
1
I made these changes to my OpenVPN set up and it attempts to connect, crashes and goes into a loop when Tasker runs the action to connect. Connecting manually through the app works fine. Any suggestions on what to check?

Edit: Nevermind, looking at my Tasker logs, it's firing the disconnect right after the connect, I'll figure out what I broke...

By any chance, were you able to resolve this? I'm having the same exact issue as you are.
 

mjones73

Senior Member
Apr 5, 2010
3,577
927
North East, MD
Yeah I didn't have the profile set up correctly.

I have two states in the profile to make it work.

Wifi Connected, SSID blank, MAC blank, IP blank, Active Any, Invert unchecked.

Wifi Connected, SSID (my white list - ssid1/ssid2/etc), MAC blank, IP blank, Active Any, Invert checked.

Set your VPN connect as your task and disconnect as your exit task.
 

13raisOr37

New member
Dec 9, 2017
2
0
Hello guys,

I have a similar problem with the OpenVPN App and Tasker:

Scenario: Whenever the phone is connected to WiFi that does not belong to me, Tasker should fire up OpenVPN and then trigger syncing of some folders via FolderSync Pro during the night.
All of that is working properly and when debugging the whole setup in Tasker everything works fine.

I use the setup taken from the first post in order to get OpenVPN to connect.
I noticed one thing when debugging the setup: Whenever Tasker gets OpenVPN to connect, Tasker will go to the background and OpenVPN will start in the foreground, then I can see the connection happening and a notification sound gets played once the connection happened, then Tasker comes back to the foreground.
I then have a wait of 15sec in Tasker after which Tasker checks whether VPN is actually successfully connected (via Tasker State "VPN connected"), if this is the case, Tasker will continue, otherwise it will create an error notification and exit.

Whenever the whole setup gets run in the background I only get the notification that OpenVPN was not connected (see above error case).
Also the Run Log of Tasker indicates that after the 15sec wait Tasker could not detect the VPN connection, OpenVPN logs also show nothing.

I think this might be related to OpenVPN coming to the foreground when Tasker gets it to connect and somehow this is not working when the phone is locked (just sitting somewhere during the night).

Does anybody have an idea what the issue could be here or how to get OpenVPN to connect "silently" ?

Note: Also setting/unsetting "Shortcut Minimize" option in OpenVPN did not make any difference.

Thanks in advance!
 
Last edited:

Leion

Senior Member
May 28, 2010
147
7
Any way to start the VPN in the background?

Sent from my LG-H930 using Tapatalk
 
Last edited:

ToXIc Games

New member
Nov 19, 2012
4
0
Still not working

It opens OpenVPN but doesn't connect.

16L56RX.jpg
 

user9082390

Member
Oct 26, 2018
40
5
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!
 
Last edited:

user9082390

Member
Oct 26, 2018
40
5
Seems like the OpenVPN plugin is no longer supported. I am having more success using intents and Open VPN Connect App (not Open VPN for Android app). But still not 100%.
 

dwertz

Senior Member
Aug 22, 2007
1,003
146
Samsung Galaxy Z Flip3
It opens OpenVPN but doesn't connect.

16L56RX.jpg

I have the exact thing but no spaces between : and PC for PROFILE_NAME:pC and no space between : and true for Autoconnect:true

Try it. see if it helps. I think this fixed mine. I also had an issue with PIA that the profile I downloaded was US West and it did not like the space. I had to rename it to uswest and change in the config. Hope this helps you.
 

jfromeo

Senior Member
Aug 7, 2011
94
10
Not working on OpenVPN 3.0.5.

I had it working for 3.0.1 if I recall correctly.

Has anything got changed?

It opens OpenVPN app but it does not connect to the profile.
 

5i1v3rStorm

Senior Member
Jun 30, 2011
243
121
OnePlus 8
OnePlus 8 Pro
Not working on OpenVPN 3.0.5.

I had it working for 3.0.1 if I recall correctly.

Has anything got changed?

It opens OpenVPN app but it does not connect to the profile.

Not working here either in 3.0.5

I can disconnect the VPN so the app listens to the intends, but I can't connect my profile.

I've tried every single option with spaces before and after each "PC" without spaces in the profile name (yes, while imported)... still nothing. The VPN app does not even start.
 

chazarss

Senior Member
Jul 18, 2013
500
117
Istanbul
OnePlus 7 Pro
Hi all, sorry for my silly question. I am trying to make task with tasker to activate private dns on specific app launches so i can avoid from ads. Is this way for that ?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 10
    Hi All,

    It would appear that the interface / code changed rather a lot in the most recent update and the previous intents are no longer working.

    I have figured out how to fix this. Please follow the directions below.

    Important Note: Your profile name is now prefixed with PC. E.g. My profile of test.co.uk/example [user] would now be PC test.co.uk/example [user]

    So, here are the settings (don't include the curly brackets):

    Connect

    Action: net.openvpn.openvpn.CONNECT
    Extra: net.openvpn.openvpn.AUTOSTART_PROFILE_NAME: PC {Your profile name}
    Extra: net.openvpn.openvpn.AUTOCONNECT: true
    Package: net.openvpn.openvpn
    Class: net.openvpn.unified.MainActivity
    Target: Activity

    Disconnect

    Action: net.openvpn.openvpn.DISCONNECT
    Extra: net.openvpn.openvpn.STOP: true
    Package: net.openvpn.openvpn
    Class: net.openvpn.unified.MainActivity
    Target: Activity

    Edit: As of the current version (3.0.4), OpenVPN no longer remains in the foreground on disconnect.
    2
    Go Home tasker task

    As another workaround for OpenVPN Connect staying in the foreground on Disconnect I added this tasks to my disconnect profile
    Wait 5 seconds
    Go Home

    Tasker has a Go Home task built in that effectively works for this use case!
    1
    Could you explain in tasker how to do it?

    Thanks

    You will need the AutoInput Tasker plugin for this to work. You can get it from here:
    https://play.google.com/store/apps/details?id=com.joaomgcd.autoinput

    1. Follow the above steps for the Disconnect task
    2. Hit the + to add a new action
    In the list that pops up, select Task -> Wait and change it to 1 second
    3. Hit the + button to add a new action
    In the list select Plugin -> AutoInput -> Global Action
    Hit the pencil icon next to Configuration
    Hit Action -> Select Back from the list
    Hit the check mark on the top right, then hit the back button to return to the Actions list
    4. Repeat #3

    Your Actions list should look like the attached image.

    I had to add the AutoInput 'Back' action twice since OpenVpn Connect backs out of the VPN Profile screen into the main app screen. The second Back action takes you to back into your last app/activity.

    It's a lazy workaround so I'm sure someone will come up with something better in time.
    1
    Thanks for sharing, i was quite annoyed by that update.
    Made my day
    1
    First of all, thank you for this post.
    Currently I'm using "go home" to "close" open vpn after disconnect.

    Latest change log says "* added minimize app on disconnect shortcut feature"
    Do you think we can use it in Tasker somehow to natively minimize the app after disconnect?
    I was using: wait 1 second and go home.

    After updating, it actually closes itself automatically now. It happens very quickly - I don't even see the OpenVPN UI.