tldr; When my WiFi connects, OR when I’m within 120m of my home, I set myself as “present”. When my WiFi is disconnected AND I’m more than 400m from home, I set myself as “not present”.
If you’re interested in Presence Reporting, you’ve probably been to the [HOW TO] SmartThings Presence reporting using Tasker/SharpTools/AutoLocation post. @destructure00 has a lot of great info there on the what/how/why as well as some links to other good resources. If you want more info, I’d recommend taking a look there.
I’m doing the same thing, only along with SharpTools, I’m using Automagic instead of Tasker & AutoLocation. The cost is pretty close, Automagic is currently $3.90 (if you want to try it out, you can get a trial version from the Automagic website here) and Tasker + AutoLocation would be $4.50. But I’ve been using Automagic for years, and I prefer it to Tasker.
I consider myself home if EITHER my WiFi connects, OR I’m within 120m of home. I consider myself departed only when my WiFi is disconnected AND I’m more than 400m from home. I don’t want my presence to bounce if my WiFi cuts out for a minute or my phone’s GPS freaks out (which happens from time to time). I don’t have this controlling access (door locks etc.) yet - when I get a connected lock (which is on my shopping list ), I may have to adjust a bit.
So on to the process:
How I make it happen
-
Create a virtual presence sensor in SmartThings.
- Open ST IDE in your browser
- Choose My Devices from the top menu
- Click the green New Device button at the top right of your device list
- Fill out Name, Label, give it a unique Device Network ID (I’m going to have one for everyone in the house, so I’m using PRESENCE_SCOTT for me), choose Simulated Presence Sensor from the Type drop-down menu, Version - Published, Location - select your location, Hub - select your hub, then Create.
-
Authorize SharpTools to access your devices
- Open SharpTools App
- Tap hamburger menu it top left corner
- Tap Settings
- Tap Authorize Things. This will take you to the ST IDE Login where you can tell ST which devices SharpTools can access.
- Once you have your presence sensor in your list of things, you need to add a subscription so AutoMagic knows when your presence changes. Find your presence sensor in the list, long press, then select Subscribe to Presence. If your subscription is successful, you will get a little star at the top right corner of the device.
-
Create global variables in Automagic
- Open Automagic App
- Tap the hamburger menu in the top left corner
- Select Global Variables
- Tap the red + icon at the bottom of the screen
- Type in “at_home” (after “global_”) to create the
global_me_home
variable and tap OK - Expand the drop-down list, and select Boolean, then set to true if you’re currently at home, or false otherwise, then tap OK
- Tap the red + icon at the bottom of the screen
- Type in “my_presence” (after “global_”) to create the
global_my_presence
variable and tap OK - Leave the type as “String”, and enter present if you’re currently at home, or not present otherwise, then tap OK
- Click the left arrow at the top of the form to return to the main screen
-
Create “Arrive Me” flow in Automagic
- Tap the red + icon at the bottom of the screen
- Open the menu by tapping the 3 vertical dots in the top-right corner and select “Rename Flow”
- Name the flow “Arrive Me”
- Select the grey box (this is the trigger box, we’ll be leaving the trigger empty for this flow)
- Tap the plus icon below the trigger box and select Condition
- Find and select the “Expression” condition type (you may need to click “NEW…” at the bottom of the screen to see the full list)
- Below Insert common script parts, tap VARIABLE, and select
global_my_presence
- In the Expression field,add:
== "present";
so you should have:global_my_presence == "present";
- Click SAVE
- Tap the plus icon below the condition box and select False
- Select Action in the next dialog box
- Find and select the “Plugin (Experimental)” action type
- From the Plugin dropdown, select “A Thing”
- Tap Configure
- Select “Simulated Presence Sensor” as the device type, your presence sensor’s name (PRESENCE_SCOTT in my case) as the device, and “arrived” as the command, then click APPLY
- Click SAVE
- Tap the plus icon below the action box and select Action
- Find and select the “Script” action type
- Below Insert common script parts, tap VARIABLE, and select
global_my_presence
- In the Expression field,add:
= "present";
so you should have:global_my_presence = "present";
- Click SAVE
- Click the left arrow at the top of the form to close (and save) the flow
-
Create “Depart Me” flow in Automagic
- Tap the red + icon at the bottom of the screen
- Open the menu by tapping the 3 vertical dots in the top-right corner and select “Rename Flow”
- Name the flow “Depart Me”
- Select the grey trigger box (we’ll be leaving this one empty too)
- Tap the plus icon below the trigger box and select Condition
- Find and select the “Expression” condition type
- Below Insert common script parts, tap VARIABLE, and select
global_me_home
- Click SAVE
- Tap the plus icon below the condition box and select False
- Select Action in the next dialog box
- Find and select the “Plugin (Experimental)” action type
- From the Plugin dropdown, select “A Thing”
- Tap Configure
- Select “Simulated Presence Sensor” as the device type, your presence sensor’s name (PRESENCE_SCOTT in my case) as the device, and “departed” as the command, then click APPLY
- Click SAVE
- Tap the plus icon below the action box and select Action
- Find and select the “Script” action type
- Below Insert common script parts, tap VARIABLE, and select
global_my_presence
- In the Expression field,add:
= "not present";
so you should have:global_my_presence = "not present";
- Click SAVE
- Click the left arrow at the top of the form to close (and save) the flow
-
Create “Geofence Arrival Boundary” flow in Automagic
- Tap the red + icon at the bottom of the screen
- Open the menu by tapping the 3 vertical dots in the top-right corner and select “Rename Flow”
- Name the flow “Geofence Arrival Boundary”
- Select the grey trigger box
- Tap the icon above the trigger box with the 4 horizontal lines (cheeseburger??)
- Find and select the “Location” trigger type (you may need to click “NEW…” at the bottom of the screen to see the full list)
- Select Method = Modern (Experimental)
- Tap “PICK LOCATION”, find your home’s location on the map, and click SAVE
- Name your location “Home120”
- Set Radius = 120.0 (you can tweak this as needed, but 120 has worked well for me)
- Check the “Entering” box under Entering / Exiting
- Click SAVE
- Tap the plus icon below the trigger box and select Action
- Find and select the “Script” action type
- Below Insert common script parts, tap VARIABLE, and select
global_me_home
- In the Expression field,add:
= true;
so you should have:global_me_home = true;
- Click SAVE
- Tap the plus icon below the action box and select Action
- Find and select the “Execute Flows” action type
- Tap the 3 dots at the end of the Flow pattern list, find and select the “Arrive Me” flow, and click OK
- Click SAVE
- Click the left arrow at the top of the form to close (and save) the flow
-
Create “Geofence Departure Boundary” flow in Automagic
- Tap the red + icon at the bottom of the screen
- Open the menu by tapping the 3 vertical dots in the top-right corner and select “Rename Flow”
- Name the flow “Geofence Departure Boundary”
- Select the grey trigger box
- Tap the cheeseburger icon above the trigger box
- Find and select the “Location” trigger type
- Select Method = Modern (Experimental)
- Tap “PICK LOCATION”, find your home’s location on the map, and click SAVE
- Name your location “Home400”
- Set Radius = 400.0 (again, tweak if needed)
- Check the “Exiting” box under Entering / Exiting
- Click SAVE
- Tap the plus icon below the trigger box and select Action
- Find and select the “Script” action type
- Below Insert common script parts, tap VARIABLE, and select
global_me_home
- In the Expression field,add:
= false;
so you should have:global_me_home = false;
- Click SAVE
- Tap the plus icon below the action box and select Condition
- Find and select the “WiFi Connected” condition type
- Tap the 3 dots at the end of the SSID List, select your home WiFi SSID(s), and click OK
- Click SAVE
- Tap the plus icon below the condition box and select False
- Select Action in the next dialog box
- Find and select the “Execute Flows” action type
- Tap the 3 dots at the end of the Flow pattern list, find and select the “Depart Me” flow, and click OK
- Click SAVE
- Click the left arrow at the top of the form to close (and save) the flow
-
Create “Home WiFi Connect” flow in Automagic
- Tap the red + icon at the bottom of the screen
- Open the menu by tapping the 3 vertical dots in the top-right corner and select “Rename Flow”
- Name the flow “Home WiFi Connect”
- Select the grey trigger box
- Tap the cheeseburger icon above the trigger box
- Find and select the “WiFi Connected” trigger type
- Tap the 3 dots at the end of the SSID List, select your home WiFi SSID(s), and click OK
- Click SAVE
- Tap the plus icon below the trigger box and select Action
- Find and select the “Script” action type
- Below Insert common script parts, tap VARIABLE, and select
global_me_home
- In the Expression field,add:
= true;
so you should have:global_me_home = true;
- Click SAVE
- Tap the plus icon below the action box and select Action
- Find and select the “Execute Flows” action type
- Tap the 3 dots at the end of the Flow pattern list, find and select the “Arrive Me” flow, and click OK
- Click SAVE
- Click the left arrow at the top of the form to close (and save) the flow
-
Create “Home WiFi Disconnect” flow in Automagic
- Tap the red + icon at the bottom of the screen
- Open the menu by tapping the 3 vertical dots in the top-right corner and select “Rename Flow”
- Name the flow “Home WiFi Disconnect”
- Select the grey trigger box
- Tap the cheeseburger icon above the trigger box
- Find and select the “WiFi Disconnected” trigger type
- Tap the 3 dots at the end of the SSID List, select your home WiFi SSID(s), and click OK
- Click SAVE
- Tap the plus icon below the trigger box and select Action
- Find and select the “Script” action type
- Below Insert common script parts, tap VARIABLE, and select
global_me_home
- In the Expression field,add:
= false;
so you should have:global_me_home = false;
- Click SAVE
- Tap the plus icon below the action box and select Condition
- Find and select the “Location” trigger type
- Tap “PICK LOCATION”, tap the 3 vertical dots in the top-right corner, select “Existing Locations”, select “Home400”, and click SAVE
- Check the “Inside” box under Accept Every Update
- Click SAVE
- Tap the plus icon below the condition box and select False
- Select Action in the next dialog box
- Find and select the “Execute Flows” action type
- Tap the 3 dots at the end of the Flow pattern list, find and select the “Depart Me” flow, and click OK
- Click SAVE
- Click the left arrow at the top of the form to close (and save) the flow
-
Toggle all 6 of the flows you created to “on” with the toggle button at the top right of each
-
Profit!
I tried to make this so someone who isn’t already familiar with AutoMagic would be able to follow it and get everything set up. Hopefully I got everything, but certainly let me know if something looks off, or if you have any questions. I’m going to test this guide by using it to add the functionality on another phone, so I’ll come back and update if I find any problems there.
Update 2/11/18: Added step for creating & using global variables, and updating labeling of locations from just “Home” to “Home120” & “Home400”
Update 12/18/19: Fixed reference to creating “global_at_home” which should have been “global_me_home”