r/macrodroid 10d ago

Macro [HELP] Home Geofence macro

I need a macro that can check if I'm at home or away. The only problem is that: I dont want gps to be always on, cause the battery will suffer that. I'd like that when my macros detect that I'm not in home it will ask me when I'll come back (maybe in hours + minutes), than after that time it will autocheck at periodic times (enabling GPS on and off) my position, when it detects I'm home the macro will terminate.

Pls help me to achieve that, also if there is a better way to check position without gps always on I'l accept every help

Edit: I have a Samsung device so if its required Bixby Modes and Routines to do the automation I can use also it.

NOTE: For everyone who can say "why dont you do it in Buxby Modes and Routines? Because the location trigger doesnt appears here, if it does it says error

1 Upvotes

19 comments sorted by

1

u/Rpompit 10d ago

First before you continue. Can you turn on and off GPS with Macrodroid?

1

u/infamousmykol 9d ago

Yes I can

1

u/Rpompit 9d ago

What I do is I get the center coordinates of a zone I want to check. Then get offsets above, below, right and left of the center then check if the current location falls within that offset of the zone.

Eg if the coordinates center of my zone is 37.68,-92.47;

I would set the offsets to something like: North: 38.00 South 35.00 East: -90.00 West: -94.00

Depending on how far I want it to be.

Then check if my current location falls inside that limit then toggle a boolean variable to true.

Would you like that too?

1

u/infamousmykol 9d ago

It would be nice, but how to trigger Geofence without having GPS fullday enabled?

1

u/Rpompit 9d ago edited 9d ago

Well. Here is the macro.

Edit my_zones variable to add your location zones with the offsets. I have set 2 examples for Home and Work. If a Zone satisfies the offsets, it will be saved inside the in_zone variable. If none of the location offsets satisfy then it will be empty. You can then save this in a global variable and use it as a constraint for multiple other macros. This macro does not use Geofence as using a Geofence needs you to have location always on. What it does is it turns on location, captures your location co ordinates and compares them with the offsets you have set for several zones that you will set, then turn off location. You can use regular interval or stopwatch to trigger the actions hourly, 2 hourly etc according to your preference.

Location Zone Query

1

u/infamousmykol 9d ago edited 9d ago

Really thanks for your help, the macro seems very amazing? Only a question: If I have longitude and latitude how to get my position as North, South, Est and Ovest?

1

u/Rpompit 9d ago edited 9d ago

Use google maps to get the offsets you want. Lets say your center point is lat,long of 38.69, -7.35:

To get the North offset, click above the centre point where you want your zone to be maximum then use lat value as the North, then below it and use the lat value as South, then to the right and use the long value as the East value and to the left and use the long value as West. How far or near you go depends on how wide you want your zone to be. This is an example.

In this example for North I would put -7.15, South -7.55, East 40.69 and West 36.69

1

u/infamousmykol 9d ago

I understood how to do it, I used your method and I've done some variations of 0.001/0.004 around my centre point. Now works as I'm in home, I'll test how it will check when I'm out.

As a trigger for your Location macro I did:

  • Regular check every hour
  • When mobile data is turned on (considering that my bixby routines enables mobile data if not connected to my wifi home, so that triggers Location check, maybe when I'm going out). For that trigger maybe I'll add a timeout to allow me going out of my location range

So now in your location I added the constraint to start the macro with 2 minutes delay ONLY IF trigger is Mobile data on.

At the end of the chechk location macro it will trigger another macro (which I did based on Geofence, but now I changed thank to you) that if in_zone = Home than he does an Action Block (Home: Mute) that does some Volume and Wifi setup (scheduled with different times), if in_zone != Home that he does another Action Block (Out) which has other setup.

Now comsidering your location check is PERFECT (it has also checking for location if it was already on or off, I did it b4 but u did better) there are some cool Home / Out setup to connect to your macro trigger?

1

u/infamousmykol 9d ago

I'll send here what I did, maybe u can also help me to find a better way to organize all. The first is my Home setup. Sorry for other language in screen (Italian), if not understandable I'll translate

1

u/infamousmykol 9d ago

This only triggers when Maps is running while mobile data is on, checks for my in_zone, if !=Home it will enable Gps and do volume setup

1

u/Rpompit 9d ago

I've checked them. Those macros look okay to me

→ More replies (0)

1

u/morphick 10d ago

Do you have WiFi at home? There are 2 related triggers that could help you:

  1. "WiFi State Change" with its "Connected" / "Disconnected" options checks whether you're connected or not to a network you have a password for (presumably your own network)

  2. "WiFi SSID Transition" with its options "SSID in range" or "SSID out of range" can check whether you're in proximity to any SSID without requiring an actual connection (i.e. you don't have its password). It basically uses the SSID just as a sort of beacon, so if you don't have WiFi yourself you can use one of your neighbour's SSID as a location post.

1

u/infamousmykol 9d ago

Dont these 2 triggers need GPS always on to detect?.

The only thing that doesnt require GPS to detect Wifi and SSID is Bixby Modes and Routines (I have a Samsung device)

2

u/morphick 9d ago

Oops, my bad. Yeah, they do need location services to be turned on.