Control WireGuard with Macros

Dimlos

Well-known member
It may depend on the version of MIUI, but I think it's in MacroDroid App info > App permissions > Additional permissions.
 

koshak

New member

Attachments

  • IMG_20231021_155638_235.jpg
    IMG_20231021_155638_235.jpg
    63 KB · Views: 21
  • IMG_20231021_155638_775.jpg
    IMG_20231021_155638_775.jpg
    55.5 KB · Views: 20
  • IMG_20231021_155638_762.jpg
    IMG_20231021_155638_762.jpg
    68.5 KB · Views: 18
  • IMG_20231021_155638_752.jpg
    IMG_20231021_155638_752.jpg
    71.2 KB · Views: 21

Dimlos

Well-known member
I will prepare a MIUI 12.5 device to verify.
It will take some time and the answer may be tomorrow.
 

Endercraft

Moderator (& bug finder :D)
of course I have,
I was able to create a working workflow in the "automate" app, because they have "wg permission" checkbox right inside their app options,
but MIUI doesn't have default android "app permissions" menu, so I can't just allow this wg permission for Macrodroid
I have another permission called run commands in Termux environment and it appears with MIUI 13 & 14.
Screenshot_2023-10-21-17-25-48-083_com.miui.securitycenter-edit.jpg
Once you get to this screen go to App permissions and Additional permissions, it should appear there (I haven't used Wireguard at all so it may be different).
 

Dimlos

Well-known member
I can grant permissions normally in MIUI 12.5.
 

Attachments

  • MacroDroid.jpg
    MacroDroid.jpg
    586.8 KB · Views: 13
  • App info.jpg
    App info.jpg
    169.8 KB · Views: 13
  • App permissions.jpg
    App permissions.jpg
    200.8 KB · Views: 13
  • Additional permissions.jpg
    Additional permissions.jpg
    154.9 KB · Views: 13

koshak

New member
Device - mix2s, miui 12.5.1, android 10
I had to use a third-party app(MIUI Hidden Settings Activity) to get to those settings.
Now wg-up action works, thanks.
But anyway, it was impossible to do it without using a third-party app.
 

Attachments

  • IMG_20231023_234018_510.jpg
    IMG_20231023_234018_510.jpg
    38.1 KB · Views: 8
  • IMG_20231023_234451_796.jpg
    IMG_20231023_234451_796.jpg
    46.3 KB · Views: 8
Have a working wireguard connection. Now I try to automate on/off. Installed everthing on the Pixel7. What I must add in the Intent send section?
Thx for helping
alpha
 

Dimlos

Well-known member
If you are downloading my macro, the only thing you need to change is the local variable.
Are you specifying tunnel names in the local variables?
 
local variable? How? The connection named "NachHause". I musst add the name in the Extra1 {lv=NachHause}?
Thx for helping
 

Attachments

  • Screenshot_20231103-222552.png
    Screenshot_20231103-222552.png
    39.8 KB · Views: 15

Dimlos

Well-known member
Please try turning them on and off manually before controlling them from MacroDroid.
Also, please read this thread carefully as it needs to be configured in MacroDroid and WireGuard.
 

Attachments

  •  Local  Variables.jpg
    Local Variables.jpg
    435.6 KB · Views: 28
The config was done acc the thread

MacroDroid Settings
App info > App permissions > Aditional permissions > control WireGuard tunnels

WireGuard Settings
Three dots in the upper right > Settings > Advanced > Allow remote control apps
Turn tunnel on once manually. (approve when alerted)

And Battery opti disabled.

Added the local variable

Wireguard works fine manualy, without Macrodroid

Musst I modify something here? See screenshoot
 

Attachments

  • Screenshot_20231103-172752.png
    Screenshot_20231103-172752.png
    123 KB · Views: 26

Dimlos

Well-known member
No need to change the intent.
In my macro, the actions are lined up so they need to be executed one at a time.
I have not tried this macro to see if it works on Android 14.
 
Top