Sharing location through variables

Previously, I wrote about sharing connected things in Stringify.  I also wrote about location based automations.  Let’s combine these two things and automate your location using variables, and then share that variable with a friend so that they can automate using your location as well.  And let’s do it across iOS and Android devices.

What’s the use case for this?

  • When my wife and I have both left home, arm the security camera.
  • When either one of us arrives home, disarm the security camera.
  • When either one of us arrives home, open the garage door.
  • When both of us leave home, turn off the lights.

The location triggers I listed above will be easily handled by a new Friends/Family location feature that we (Stringify) will be releasing soon.  In the meantime, you can create those same triggers yourself by sharing Variables with a Stringify Friend.  Add a Friend thing and then Follow the procedure below.

I have two phones, one is an iPhone and the other is a Google Pixel.  Each device is using a separate Stringify account.  Follow this guide assuming that you have the iPhone and your friend has the Pixel.  I’m going to share my home location state from my iPhone to my Pixel and automate things accordingly.  To do this, I made a couple flows that work together.  The first flow lives on my iPhone.  It’s one that I made in a previous post called “Set home state”.  The second flow also lives on my iPhone, and it will trigger based on the variable that the first flow is setting.  The third flow lives on my Pixel, and it will trigger when my iPhone’s second flow updates its location.  The second and third flows are connected through the maker request, despite being on separate Stringify accounts.

This flow requires that the “Set home state” flow has already been created.  We’re going to trigger a Maker REST request when your location changes.  That request is going to make a call to the Pixel’s Stringify account from the iPhone’s Stringify account.

 

 

Configure your Variable thing as “When a variable changes” and select your “HomeState” variable you created in your other flow.  Configure the Maker thing as “Send an HTTP POST”.  We don’t yet have a URL to enter in the URL field, we’ll generate that on the Pixel.  Select JSON data and give “Field 1 Name” a name that you’ll need to use later.  In “Field 1 Value”, you’ll need to hit the “+” and add in the Variable Value from your Variable thing that you already configured.  This is the value that’s inside your variable.

This iPhone flow won’t enable just yet because we still need to put a URL into this Maker thing.  So i’ll switch over to the Pixel flow for now.

 

 

On the Pixel, we are now creating a flow that receives the request from the iPhone.  It’s coming from the iPhone’s variable, so I’m just going to store it in a variable on the Pixel’s side.  And i’ll also send myself a notificaiton so I can confirm it worked.

Configure your Maker trigger as “Send Stringify an HTTP GET/POST” and it will generate a URL for you to use.  This URL is the one that you need to copy and paste into your iPhone’s flow that we started above.  Once you’ve done that, you can successfully save that Maker thing and enable that flow on the iPhone.  Now let’s get back to the Pixel and finish this third flow.

 

 

Once we receive the maker request from the iPhone’s flow, our Pixel’s flow will store it in a variable.  Remember that “Field 1 Name” and “Field 1 Value” we set on the iPhone?  Well here’s where we use it.  Configure your Variable as “Set variable to a value” and register a new variable.  I called it JoeysiPhoneHomeState.  I didn’t want to just call it HomeState because I already used the HomeState variable for my Pixel.  For the value field, hit the “+” and set Value 1, since we passed the value in “Field 1 Value” from the iPhone’s flow.  Then Configure the notifications thing as “Send me a push notification” enter in a meaningful message.

 

Once you get all three flows up and running, take a walk and test them out.  Here’s a screenshot showing my Pixel receiving notifications when my iPhone entered/left the office.

 

 

Here are screenshots of the flows created for this post.  I shared my “OfficeState” and “HomeState” variables.

Once you can share variables, the automation possibilities multiply.  Smart device sharing goes beyond just location.  Combine things like locks, lights, switches, digital services, etc and see what you can come up with.

Let’s look back at my first example on how to apply location sharing, “When my wife and I have both left home, arm the security camera and turn off the lights”.  Follow my procedure above and you’ll end up with two variables, “HomeState” and “WifesHomeState”.  Then it’s easy to create a flow that triggers when both of you enter or leave home.

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

Stringify in the App Store

Stringify in Google Play

“Set home state, using Variables”

“Share Joey iPhone’s home state, using Variables”

“Joey iPhone’s home state changes, using Variables”

Comments are closed.