Can anybody help me set up this macro?

I'm having some trouble getting a macro to work the way I want it to, I need some help...

When I first discovered MacroDroid I was really excited because it seemed simpler to use than other automation apps I've tried setting up, but I'm getting stuck in a loop now. I want to turn on wifi when I get home or to work, and turn off wifi when I leave home of work. I originally created 4 separate macros: one each to turn on wifi when I entered home or work geofence, and one each to turn off wifi when I left home or work geofence. That worked fine. I later realized after some "research" and experimenting, that I didn't need 4 separate macros, so I created a new macro with 4 triggers (enter home geofence, exit home geofence, enter work geofence, exit work geofence), and 2 actions using "IF" logic: 1) IF trigger fired: geofence entry: home OR trigger fired: geofence entry: work > enable wifi > end IF 2) IF trigger fired: geofence exit: home OR trigger fired: geofence exit: work > disable wifi > end IF. That worked as well.
My problem now is I want to add a condition - I use wireless Android Auto which uses wifi, so I want to change the macro to only disable wifi when I leave either of my geofences only if I'm not connected to Android Auto. I tried adding constraints, but I'm obviously doing something wrong because I can't get it to work properly. Once I leave the geofence area it disables wifi. I tried adding a delay also just in case, but that didn't help. I'm sure I'm missing something small and stupid, but as the name implies I can be an idiot at times 🤓

What would be the simplest / cleanest way to set up this macro to run the way I want? Enable wifi when I enter either home or work geofence, disable wifi when I exit home or work geofence only if not connected to Android Auto.
 

Pseudocyclic

Well-known member
Add an "AND not connected to Android Auto" condition to the "IF trigger fired: geofence exit: home OR trigger fired geofence exit: work > disable wifi > end IF"
 
How do I add the "AND not connected to Android Auto" condition? I was thinking along those lines, one of the steps I tried was adding it to the ID clause, but I can obviously only choose between OR or AND for multiple conditions. So I need to add "AND not connected to Android Auto" after "IF trigger fired" and before "disable wifi"? Where would I find the "AND" condition? I can't seem to find it anywhere...
 
Where do I find the "add condition" screen? I don't see that anywhere. Unless you mean I should add it as a constraint? I was able to find it there, but then it's listed as a "sub" of disable wifi, and I'm thinking it should be a "sub" of the exit geofence?
 
Ok I'm an idiot! I was going in circles trying to find and add the "AND", I just deleted the entire action and started over. Now I have:
IF trigger fired: geofence exit: home OR trigger fired: geofence exit: work OR AND (Not foreground) > disable wifi
The logic makes sense to me, but that doesn't really mean anything! 🤣
I am going to enable this and see if it runs right...
Thanks!
 
OK I have no idea what I did wrong, but it's still not working properly. When I leave either geofence area it disables wifi, and system log says: "If clause did not invoke because no constraints were true (If clause)"
Even stranger, when I entered the geofence area, it enabled wifi, then immediately disabled it.
For the "AND" I did select Android Auto, I don't know why it doesn't list it...

Wifi_on-off.png
 

420

Active member
OK I have no idea what I did wrong, but it's still not working properly. When I leave either geofence area it disables wifi, and system log says: "If clause did not invoke because no constraints were true (If clause)"
Even stranger, when I entered the geofence area, it enabled wifi, then immediately disabled it.
For the "AND" I did select Android Auto, I don't know why it doesn't list it...

View attachment 253
sorry i don't have an answer for your other questions, but the text in the system log when either of the exit triggers fire just refers to the first if clause not being true, which would be correct, aslong as it disables the wifi when either exit area trigger fires they are working fine.
 

Pseudocyclic

Well-known member
Try this:
 

Attachments

  • Screenshot_20210407-003822_MacroDroid.jpg
    Screenshot_20210407-003822_MacroDroid.jpg
    248.5 KB · Views: 26
  • Screenshot_20210407-012313_MacroDroid.jpg
    Screenshot_20210407-012313_MacroDroid.jpg
    312.5 KB · Views: 23
sorry i don't have an answer for your other questions, but the text in the system log when either of the exit triggers fire just refers to the first if clause not being true, which would be correct, aslong as it disables the wifi when either exit area trigger fires they are working fine.
Maybe, but why would the entry trigger fire when exiting?
 
My mistake, I have corrected it now.
I tried it, and had the same issue. It still disabled the wifi, system log says "If clause did not invoke because constraint failed: OR (Trigger Fired, Trigger Fired) (WiFi on/off)" except this was in grey text, last time I got this message the text was blue, not sure what the difference is...
After this I looked at your screenshots again, and realized instead of 2 separate IF trees (enable and disable) you had IF (enable) and ELSE IF (disable). I tried that, and the good news is it didn't turn off wifi, the bad news is it didn't do anything. There's no entries in the system log since changing that, and I drove around and through my geofence a number of times (which is how I've been testing all this time, and it has been triggering).

Now I'm not sure what to think...
 

420

Active member
Maybe, but why would the entry trigger fire when exiting?
it's not the entry triggers that fire when exiting, when any of those 4 triggers go off the whole macro is ran.
so when your exit triggers fire, it will also run the if clause that checks if the entry triggers fired, so there will always be if clauses that fail. it's nothing to worry about just means macrodroid is doing it's job.
 
it's not the entry triggers that fire when exiting, when any of those 4 triggers go off the whole macro is ran.
so when your exit triggers fire, it will also run the if clause that checks if the entry triggers fired, so there will always be if clauses that fail. it's nothing to worry about just means macrodroid is doing it's job.
Yeah I didn't think about that until you actually spelled it out, thanks.
 

Pseudocyclic

Well-known member
Making changes to the actions would not alter how the triggers fire.

Check you haven't accidentally disabled the macro or the category. Or MacroDroid.
 
Top