Automating based on your location

Some of IoT’s most fundamental automations concepts utilize your location; for example, “When I leave home, turn off my lights” or “When I arrive home and it’s nighttime, turn on my lights”.  Your location is determined by a geofence living on your iOS or Android device within the Stringify app.  If you need help along the way, here’s a good reference for building stringify automations (or as we call them, flows).

First, i’ll demonstrate how to make the above mentioned flows.  Then i’ll demonstrate a more efficient way to make them.  Finally, i’ll give more examples of useful location automations.

“When I leave home, turn off my lights”

Let’s create a flow that turns my lights out when I leave home.  Get your Location and light things ready, and drag them onto the canvas.  Once placed, you connect them by dragging one to the other.



Configure your Location as “I leave an area” and configure your light as “Turn off the light”.  Make sure to set the region with your home in the very center of the blue circle.


Here is the end result.  Now when you leave home, your lights will turn off.  I suggest adding a notification on the end of it, so you receive a notification when the flow has run.

“When I arrive home and it’s nighttime, turn on my lights”


Now let’s create a flow that turns on the lights when I arrive home, only if it’s nighttime.  This one involves Location, your light, and Date & Time.  The trick here is that Location is your “when” trigger and Date & Time is your “only if” trigger.  And the Date & Time is configured as “nighttime”.  Also, make sure your Location trigger is configured as “I enter an area” and that your light action is configured as “Turn on the light”.

A Better Way

This works great and all, but there’s a better way.  Imagine if you have 5 or 10 flows that are all using your Location.  You don’t want to have to configure the Location thing 5 or 10 times.  What if you want to change the address or update the region size?  You’d have to change it in 5 or 10 flows.  Now i’ll demonstrate a much more efficient way to manage your Location, using Functions: Variables.

“Set Home State”

Create a flow using Location and Variables.  The key change here, is that we only have one single Location thing per location region.  So i’ll only have to set my home location region one time.  Then, when that region state changes between “Entered” or “Left”, i’m simply updating a variable in my Variables thing.  Then all other flows can simply access that variable at any moment.  And if someday I need to change my location or region radius, there is only one place it needs changed, in this flow we just made.



Configure the Location thing as “I enter or leave an area”.  And configure the Variables thing as “Set variable to a value”.  Register a new variable and name it something like “HomeState”.  Hit the “+” in Variable Value and select the “Entered or Left” parameter.  It’s that simple.

“Home State Changes”

The previous flow is setting your location variable.  Now i’ll show you how to do something when you location changes.  You can do anything you want when this variable changes.  In this simple case, i’m sending myself a notification.



Configure the Variables thing as “When a variable changes” and select the variable you created in the previous flow, “HomeState”.  Notice that this is case-insensitive.  Configure your Notification thing as “Send me a push notification” and use the “+” to add your parameters.  The “Variable Name” is the name of your variable, in this case “HomeState”.  The “Variable Value” will be whatever you set it as, in this case either “Entered” or “Left” depending on your location region state.

“When I arrive home (using Variables) and it’s nighttime, turn on my lights”


Now let’s revisit the flow we made earlier, and use a Variables thing instead of a Location thing.  The when trigger now reads, “When my variable ‘HomeState’ changes to ‘Entered’…” and the rest of the flow remains the same.  Only if it’s nighttime… and turn on my light…


Here are links to apps and flows mentioned in this post:

Stringify in the App Store

Stringify in Google Play

“When I leave home, turn off my lights”

“When I arrive home and it’s nighttime, turn on my lights”

“Set home state, using Variables”

“Home state changes, using Variables”

When I arrive home (using Variables) and it’s nighttime, turn on my lights”

Comments are closed.