FORUMS

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

654 posts
Thanks Meter: 581
 
By mmotti, Senior Member on 16th February 2018, 02:03 PM
Post Reply Email Thread
16th August 2019, 02:34 AM |#41  
Junior Member
Thanks Meter: 1
 
More
Quote:
Originally Posted by maksim789

I have the same problem. It just opens the App and shows me the profile. Any solutions for this?

I am having more success using intents and Open VPN Connect App (not Open VPN for Android app)
1st February 2020, 05:19 PM |#42  
beatschubser's Avatar
Senior Member
Flag Munich
Thanks Meter: 50
 
More
Quote:
Originally Posted by user9082390

I am having more success using intents and Open VPN Connect App (not Open VPN for Android app)

Could you share your profile? I cannot get it to work with OpenVPN Connect.
1st February 2020, 06:18 PM |#43  
Junior Member
Thanks Meter: 1
 
More
Quote:
Originally Posted by beatschubser

Could you share your profile? I cannot get it to work with OpenVPN Connect.

Oh gosh yeah I would love to, is there an easy way to export it out of Tasker and paste it into here? I'm still a noob. Otherwise I will type out my solution like this:
I have three profiles, as below, with 4 different tasks.
-------------------------------------------------------------------
Wifi Connected > VPN Connect Intent
VPN Disconnect Intent

Wifi Connected + Not VPN Connected > VPN Connect (note this is not my intent task)

Not Wifi Connected > VPN Disconnect (not this is not my intent task either)
-----------------------------------------------------------------------
Tasks:
VPN Connect = OpenVPN Configuration Connect and connect to my VPN

VPN Disconnect = OpenVPN Configuration Disconnect

VPN Connect Intent=
1. Send Intent
Action net.openvpn.openvpn.connect
2. Wait
4 seconds
3. Go Home
Page 0
4. Go Home
Page 0

VPN Disconnect Intent=
VPN Connect Intent=
1. Send Intent
Action net.openvpn.openvpn.disconnect
2. Wait
4 seconds
3. Go Home
Page 0
4. Go Home
Page 0
------------------------------------------------------------------------------

My apologies that I can't really explain at all how this works, it was all trial and error to put together. It does work 99% of the time though for me, which has made me happy. If you know of an easier way for me to share these let me know and I'll try that too.
1st February 2020, 07:36 PM |#44  
beatschubser's Avatar
Senior Member
Flag Munich
Thanks Meter: 50
 
More
Quote:
Originally Posted by user9082390

My apologies that I can't really explain at all how this works, it was all trial and error to put together. It does work 99% of the time though for me, which has made me happy. If you know of an easier way for me to share these let me know and I'll try that too.

No worries, thanks for your reply? I figured it out now, had a typo in one the intent parameters. Here's the intent, it works with the current version of OpenVPNConnect:

Code:
<Str sr="arg0" ve="3">net.openvpn.openvpn.CONNECT</Str>
<Int sr="arg1" val="0"/>
<Str sr="arg2" ve="3"/>
<Str sr="arg3" ve="3"/>
<Str sr="arg4" ve="3">net.openvpn.openvpn.AUTOSTART_PROFILE_NAME: PC openvpnprofilename</Str>
<Str sr="arg5" ve="3">net.openvpn.openvpn.AUTOCONNECT: true</Str>
<Str sr="arg6" ve="3"/>
<Str sr="arg7" ve="3">net.openvpn.openvpn</Str>
<Str sr="arg8" ve="3">net.openvpn.unified.MainActivity</Str>
<Int sr="arg9" val="1"/>
2nd February 2020, 11:43 AM |#45  
Quote:
Originally Posted by beatschubser

No worries, thanks for your reply? I figured it out now, had a typo in one the intent parameters. Here's the intent, it works with the current version of OpenVPNConnect:

Code:
<Str sr="arg0" ve="3">net.openvpn.openvpn.CONNECT</Str>
<Int sr="arg1" val="0"/>
<Str sr="arg2" ve="3"/>
<Str sr="arg3" ve="3"/>
<Str sr="arg4" ve="3">net.openvpn.openvpn.AUTOSTART_PROFILE_NAME: PC openvpnprofilename</Str>
<Str sr="arg5" ve="3">net.openvpn.openvpn.AUTOCONNECT: true</Str>
<Str sr="arg6" ve="3"/>
<Str sr="arg7" ve="3">net.openvpn.openvpn</Str>
<Str sr="arg8" ve="3">net.openvpn.unified.MainActivity</Str>
<Int sr="arg9" val="1"/>

Sorry, noob question but how exactly do you put the above input into Tasker?
2nd February 2020, 08:21 PM |#46  
ktmom's Avatar
Forum Moderator
Flag Deep Space Station K7
Thanks Meter: 3,197
 
More
Quote:
Originally Posted by user9082390

Oh gosh yeah I would love to, is there an easy way to export it out of Tasker and paste it into here? I'm still a noob. Otherwise I will type out my solution like this:
I have three profiles, as below, with 4 different tasks.
-------------------------------------------------------------------
Wifi Connected > VPN Connect Intent
VPN Disconnect Intent

Wifi Connected + Not VPN Connected > VPN Connect (note this is not my intent task)

Not Wifi Connected > VPN Disconnect (not this is not my intent task either)
-----------------------------------------------------------------------
Tasks:
VPN Connect = OpenVPN Configuration Connect and connect to my VPN

VPN Disconnect = OpenVPN Configuration Disconnect

VPN Connect Intent=
1. Send Intent
Action net.openvpn.openvpn.connect
2. Wait
4 seconds
3. Go Home
Page 0
4. Go Home
Page 0

VPN Disconnect Intent=
VPN Connect Intent=
1. Send Intent
Action net.openvpn.openvpn.disconnect
2. Wait
4 seconds
3. Go Home
Page 0
4. Go Home
Page 0
------------------------------------------------------------------------------

My apologies that I can't really explain at all how this works, it was all trial and error to put together. It does work 99% of the time though for me, which has made me happy. If you know of an easier way for me to share these let me know and I'll try that too.

In order of easiest to import;

You can use taskernet to export a shareable link. Make sure the task (profile/project) is named, long press the name to select it, in the 3-dot menu select export -> as link. Then late the link here.

Else, export as a XML to storage, then attach that file here.

Finally, export description to clipboard and paste here.
Post Reply Subscribe to Thread

Tags
3.0.0, openvpn, solution, tasker

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes