Location based flow

General discussions about Automagic and automation in general

Moderator: Martin

Post Reply
Dirk
Posts: 3
Joined: 30 Nov 2016 05:41

Location based flow

Post by Dirk » 07 Dec 2016 23:25

I can't quite wrap my head around how to do this with Automagic. Here is my scenario:

I want to set a certain Cyanogenmod profile when I arrive at church. I want to conserve battery, so I don't want to have my GPS on all the time. There are no WiFi networks or NFC tags at my church, so that leaves cell mast location fixing. There appears to be only 1 cell mast near my church, but I don't want to set the phone profile based solely on that cell mast as I have plenty of business in the area around the church, and I only want the profile set when I am actually at the church.

I was thinking of detecting when I am near the cell mast, and then turning on GPS to get finer location information. Once within a certain radius of the church, change the phone profile. When I leave the church area, change my phone profile to a different profile.

I started with a trigger on the cell mast, followed by an action to turn on the GPS, followed by a Location condition of 100m around the church. Since this will only run once upon detecting the cell mast, it didn't work as intended, which I get. How do I go about getting the rest of this flow to work?

Can this be done with Automagic?

User avatar
Scotty
Posts: 78
Joined: 26 Aug 2016 20:29
Location: Southern California

Re: Location based flow

Post by Scotty » 08 Dec 2016 00:09

One way to do it would be to build in a loop to re-check the location condition every so often until it returns "True".

So, the flow starts when you're near the cell mast.
It turns on GPS, and then checks to see if you're within 100m of the church. This returns either false or true. If false, sleep for (say) 30s then re-check the condition (that's the loop). If still false, it'll re-check 30 secs later. When you're near the church, the condition returns "True" and takes you to the actions to turn your phone to silent (or whatever you want).

Another way would be to have two flows, the first of which enables the second.

Flow 1. This is enabled all of the time, and triggers when you're near the cell mast; that trigger leads to an action of "enable the second flow".

Flow 2. This flow is usually disabled, and is enabled by flow 1 above (when you're near the cell mast). This 2nd flow's trigger is "Periodic location update", which is followed by actions to turn on GPS and to look for your being within the described location (in this case, near your church). Because of its trigger, this flow will run periodically (not just once) until you disable it. I use locations a lot, and this is the way that I prefer. I keep each of my locations in a separate flow, and each of the flows has a Periodic Location Update trigger. All of the flows are usually disabled (so they're not running when I'm at home, or at work). They're all collected in a single group, named "Locations". When I get into my car, I have a drive mode flow that gathers the names of all flows in the "Locations" group, and enables them; and when drive mode turns off, those flows are all disabled again. One nice thing about this setup is that, if I want to add a new location flow, or remove one that I no longer need, I don't mess with my Drive Mode flow -- I just move the new location flow into (or move the unwanted one out of) the Locations group. This allows me (for example) to have different sets of location flows for different cities, and easily interchange between the cities by moving the relevant flows into (or out of) my Locations group.

Post Reply