Update May 9 2017 - I finally have a setup that has been pretty much rock solid for my phone and now my wife’s too. Updating the instructions below to reflect my latest configuration
What is this? An alternative way to set presence in SmartThings using your Android phone. This solution uses three separate mobile phone apps, Tasker, SharpTools, and AutoLocation. These are all paid apps, but you’re looking at a total of around $7.50 for all three. Tasker and AutoLocation are eligible for Google Family, so if you are setting up for multiple family devices you only have to buy them once.
Why would I do this? Presence sensing in SmartThings relies on your phone to update it’s location using standard Android location services. Even if you set your phone to use High Accuracy location settings, it only checks in every few minutes to update location, which means that you typically have to set a very large radius circle around your home in order to give your phone enough time to “see” that you are inside the circle before you actually arrive home. This can lead to annoyances like being checked in as Present when you are just driving close by your house, or needing to set a HUGE radius to give your phone enough time to check in, having different phones that need different settings, etc. There’s also the occasional issues that many have seen with presence getting “stuck” as away, requiring the phone/sensor to be deleted and re-added to ST.
How does it work? This setup uses a combination of Tasker, AutoLocation, and Sharptools apps on your Android phone (I’m not aware of an iPhone alternative) to set a virtual presence sensor in SmartThings. Tasker is the app that you create the rules/automations in (think CoRE, or IFTTT on steroids and with a PhD). AutoLocation is a powerful and flexible location plugin for Tasker that can be set to update location at a set interval using Fused Location services (google it, I’m not up on all the details except it works well). You can set up profiles in Tasker to turn this location service on and off as needed (higher location accuracy = higher battery drain, so it’s better to keep it off unless needed). SharpTools is, in this context, a Tasker plugin that allows Tasker automations to control stuff in your SmartThings setup. It can also be used to add widgets to your phone’s home screen, but that’s another topic.
Relevant Links
AutoLocation FAQ
Example AutoLocation setup video - not the same as my setup below, but similar
SharpTools Custom Presence Example
Tasker Location Without Tears article
SharpTools app download
Tasker app download
AutoLocation app download
AutoLocation Unlock Key download
I’ll detail my setup below. Everyone’s unique circumstances are different, so it may require some tweaking to get things right for your setup. If you see any issues in the instructions below, please let me know and I will correct.
In plain English
This setup consists of 3 geofences in AutoLocation, along with 6 profiles with various tasks in Tasker. AutoLocation stays disabled until I am near home. Once I am near home (when I enter a large 1500m radius location service boundary), Tasker tells AutoLocation to switch on high accuracy mode and update my location every 3 seconds. When I arrive home (enter a small 120m radius arrival boundary) , Tasker tells SharpTools to set me as Present. When I connect to my home Wifi network, Tasker tells AutoLocation to switch off high accuracy mode. As long as I stay connected to my home wifi network or I stay inside my departure boundary, I stay Present. Once I disconnect from my wifi network, Tasker tells AutoLocation to start high accuracy mode again. If I am disconnected from wifi and leave my departure boundary, SharpTools tells SmartThings to set me as Not Present. Once I leave my location service boundary, Tasker tells AutoLocation to turn off high accuracy mode.
Configuration
- Create 3 Geofences in AutoLocation
a. Home - Arrival Boundary (120m radius centered on your home)
b. Home - Departure Boundary (400m radius centered on your home)
c. Home - Location Service Boundary (1500m centered on your home) - Create two variables in Tasker
a. %YourName (replace YourName with your actual name) - initialize to “present” if you are home, “not present” if you are not home
b. %Rebooting - initialize to “false” - Create two named tasks in Tasker (the rest will be anonymous and added along with the profiles)
- Depart YourName
a. Action 1: Wait 5 seconds
b. Action 2: Sharptools - Thing: YourPresenceSensorName, Command: departed, If %PACTIVE !~ [asterisk],Home,[asterisk] (replace [asterisk] with actual asterisk)
c. Action 3: Wait 5 seconds, If %PACTIVE !~ [asterisk],Home,[asterisk]
d. Action 4: Perform Task, name Depart YourName (the name of this action, you are telling it to loop itself), If %YourName eq present and %PACTIVE !~ [asterisk],Home,[asterisk] - Arrive YourName
a. Action 1: Sharptools - Thing: YourPresenceSensorName, Command: arrived
b. Action 2: Wait 1 second
c. Action 3: Perform Task Arrive YourName (name of this action, you are telling it to loop itself), if %YourName eq not present
- Create the 6 Tasker profiles and associated tasks
- Near Home
a. State - AutoLocation - Geofence NameL Home - Location Service Boundary, Status: Inside
b. Entry Task 1: AutoLocation Location - Starting Location Monitor, Interval 3 seconds, Update Type High Accuracy, If %Rebooting eq false and %PACTIVE !~ [asterisk],Home WiFi Connected,[asterisk]
c. Entry Task 2: Notify - Title: High Accuracy Location On, If %Rebooting eq false and %PACTIVE !~ [asterisk],Home WiFi Connected,[asterisk]
d. Entry Task 3: Variable Set %Rebooting to false
e. Exit Task 1: AutoLocation Location - Stopping Location Monitor, Update Type: No Power
f. Exit Task 2: Notify Cancel - Title: High Accuracy Location On - Home WiFi Connected
a. State: Wifi Connected, SSID - enter your home Wifi network name(s)
b. Entry Task 1: AutoLocation Location - Stopping Location Monitor, Update Type: No Power
c. Entry Task 2: Notify Cancel - Title: High Accuracy Location On
d. Entry Task 3: Perform Task: Arrive YourName (this is one of the tasks you created in step 3 above)
e. Exit Task 1: AutoLocation Location - Starting Location Monitor, Interval: 3 seconds, Update Type: High Accuracy
f. Exit Task 2: Notify - Title: High Accuracy Location On - Home
a. State: AutoLocation - Geofence Name: Home - Arrival Boundary, Status: Inside
b. Entry Task: Perform Task : Arrive YourName, If %YourName eq not present - Away
a. State 1: AutoLocation - Geofence Name: Home - Departure Boundary, Status: Outside
b. State 2: Variable Value: %PACTIVE !~ [asterisk],Home WiFi Connected,[asterisk]
c. Entry Task: Perform Task Depart YourName, If %YourName eq present - Device Shutdown
a. Event: Device Shutdown
b. Entry Task: Variable Set %Rebooting to true, If %PACTIVE ~ [asterisk],Near Home,[asterisk] - YourName Variable Set
a. Event: Sharptools - Thing: YourPresenceSensorName, Attribute: presence
b. Entry Task: Variable Set %YourName to %st_attr_value
Detailed setup steps
-
Create a virtual presence sensor in SmartThings.
a. Open ST IDE in your browser
b. Choose My Devices from the top menu
c. Click the green New Device button at the top right of your device list
d. Fill out Name, Label, give it a unique Device Network ID (something like presence-001, -002, etc should work, choose Simulated Presence Sensor from the Type drop-down menu, Version - Published, Location - select your location, Hub - select your hub, then Create.
-
Install all three apps on your phone. The rest of the steps below assume that you have the full paid version of the apps.
-
Authorize SharpTools to access your devices
a. Open App
b. Tap hamburger menu it top left corner
c. Tap Settings
d. Tap Authorize Things. This will take you to the ST IDE Login where you can tell ST which devices SharpTools can access.
e. Once you have your presence sensor in your list of things, you need to add a subscription so Tasker knows immediately 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.
-
Set AutoLocation advanced settings so you don’t leave home if you drop internet connection
a. Open the AutoLocation app
b. Go to Advanced, near the bottom of the list
c. Uncheck the Exit Geofences When Connections Lost option
d. I also unchecked Exit Geofences when toggling Geofence monitor, not sure if this is necessary but I don’t want to accidentally set myself as Not Present if I’m messing around with AutoLocation settings
e. I also checked Force Location Monitor to help Geofences…because why not? Seems like it can only help. -
Set up your Geofences in AutoLocation app
a. Open App
b. Tap Manage Geofences
c. Tap + at the top of the screen
d. Find your house on the map, tap it to center the geofence on that location
e. Use either the slider on the bottom or tap the orange carrot thingy on the bottom right corner to set the radius. (I used 1500 meters for my “Home - Location Service Boundary”, 400m for my “Home - Departure Boundary”, and 120m for my “Home - Arrival Boundary”, start here and tweak it later to fit your particular needs)
f. Tap accept Geofence at the bottom and give it a name. I used Home - Location Service Boundary, Home - Departure Boundary, and Home - Arrival Boundary.
g. Repeat step 5 to set up your second and third geofences -
Create your two variables in Tasker
a. From Tasker, tap the VARS tab
b. At the bottom of the screen, tap the + to add a new variable
c. After the %, type your name.
d. Repeat 6a, 6b, 6c to add your second variable, but change the name to Rebooting in step 6c
e. Tap each variable name to initialize a value. For %YourName, enter either present or not present depending on where you are, then tap the check mark to accept. For %Rebooting, enter false
-
Create your first named Task in Tasker (Depart YourName)
a. From Tasker, tap the TASKS tab
b. Tap the + at the bottom of the page to add a new task
c. For New Task Name, enter Depart YourName and tap the check mark
d. Tap the + at the bottom of the screen to add a new action, then tap Task, Wait, change the value to 5 seconds, tap Back to return to the Task Edit screen
e. Tap + again, Plugin, SharpTools, A Thing, Configuration Pencil. When SharpTools opens, select Simulated Presence Sensor from the first field, select the correct sensor from the second field, departed in the third field, then tap Apply. Scroll down and tap the + next to the If to add a restriction. In the left operand, enter PACTIVE, tap the “~” operand and change it to “!~”, then enter [asterisk],Home,[asterisk] in the right operand. Tap back to accept and return to the Task Edit screen
f. Tap + again, Task, Wait, change to 5 seconds, scroll down and tap + next to If to add restriction, set to %PACTIVE !~ [asterisk],Home,[asterisk], then tap back to return to Task Edit screen
g. Tap + again, Task, Perform Task, and type Depart YourName in the name field. Scroll down, tap the + next to the If two times to add two restrictions. Set first restriction to %YourName eq present, second restriction to %PACTIVE !~ [asterisk],Home,[asterisk]. Tap back to return to the Task Edit screen, then back again to return to the main Tasks screen. Tap the check mark at the top of the screen to apply all changes
-
Create your second named Task in Tasker (Arrive YourName)
a. From Tasker, tap the TASKS tab
b. Tap the + at the bottom of the page to add a new task
c. For New Task Name, enter Arrive YourName and tap the check mark
e. Tap + to add a new action, Plugin, SharpTools, A Thing, Configuration Pencil. When SharpTools opens, select Simulated Presence Sensor from the first field, select the correct sensor from the second field, arrived in the third field, then tap Apply. Tap back to accept and return to the Task Edit screen
f. Tap + again, Task, Wait, change to 1 seconds, then tap back to return to Task Edit screen
g. Tap + again, Task, Perform Task, and type Arrive YourName in the name field. Scroll down, tap the + next to the If to add a restriction. Set restriction to %YourName eq not present. Tap back to return to the Task Edit screen, then back again to return to the main Tasks screen. Tap the check mark at the top of the screen to apply all changes
-
Create your Near Home profile
a. From Tasker, tap the PROFILES tab
b. Tap the + at the bottom of the screen to create a new profile, then State, Plugin, AutoLocation, Geofences, Configuration Pencil. Tap Geofence Name, select Home - Location Service Boundary, then tap Status, Inside. Tap the check at the top of the screen to accept, then back
c. Tap New Task, leave name blank and tap the check mark. This will take you to the Task Edit window.
d. Tap + to add a new action, Plugin, AutoLocation, Location, Configuration Pencil. Tap Location Monitor, select Start, tap Update Type, select High Accuracy, tap Interval, enter 3, tap ok. Tap the check mark at the top of the screen to accept. Scroll down to the If section, tap the + twice to add two new restrictions. Set first restriction as %Rebooting eq false, second restrictions as %PACTIVE !~ [asterisk],Home WiFi Connected,[asterisk]. Tap back to accept
e. Tap + to add a second new action, Alert, Notify. Set Title = High Accuracy Location On, add two If restrictions, Set first restriction as %Rebooting eq false, second restrictions as %PACTIVE !~ [asterisk],Home WiFi Connected,[asterisk]. Tap back to accept
f. Tap + to add a third new action, Variables, Variable Set. Name: %Rebooting, To: false. Tap back until you get back to the main Tasker screen, then tap the check mark at the top of the screen to accept changes.
g. Rename the profile - Long press on the profile name (it should be something generic like AutoLocation Geofences Geofences), tap the letter A at the top of the screen, enter Near Home, tap the check mark.
h. Add your Exit tasks - long press on the green arrow under your profile name, then tap Add Exit Task
i. Tap the + to add a new action, Plugin, AutoLocation, Location. Configuration pencil, tap Location Monitor, select Stop, tap Update Type, select No Power. Tap the check to accept, back to go go to Task Edit screen.
j. Tap + again to add a second action. Alert, Notify Cancel, title High Accuracy Location On. Tap back to accept and then again to go back to main Tasker menu -
Create your Home WiFi Connected profile
a. From Tasker, tap the PROFILES tab
b. Tap the + at the bottom of the screen to create a new profile, then State, Net, Wifi Connected. Enter your WiFi SSID (you can enter multiples separated by “/”, or select from a list of currently detected networks by tapping the magnifying glass. Tap Back to accept
c. Tap New Task, leave name blank and tap the check mark. This will take you to the Task Edit window.
d. Tap + to add a new action, Plugin, AutoLocation, Location, Configuration Pencil. Tap Location Monitor, select Stop, tap Update Type, select No Power, tap ok. Tap the check mark at the top of the screen to accept. Tap back to accept
e. Tap + to add a second new action, Alert, Notify Cancel. Set Title = High Accuracy Location On. Tap back to accept
f. Tap + to add a third new action, Task, Perform Task. Name: Arrive [yourname]. Tap back until you get back to the main Tasker screen, then tap the check mark at the top of the screen to accept changes.
g. Rename the profile - Long press on the profile name (it should be something generic like Wifi Connected [ssid]), tap the letter A at the top of the screen, enter Home WiFi Connected, tap the check mark.
h. Add your Exit tasks - long press on the green arrow under your profile name, then tap Add Exit Task
i. Tap + to add a new action, Plugin, AutoLocation, Location, Configuration Pencil. Tap Location Monitor, select Start, tap Update Type, select High Accuracy, tap Interval, enter 3, tap ok. Tap the check mark at the top of the screen to accept. Tap back to accept.
j. Tap + again to add a second action. Alert, Notify, title High Accuracy Location On. Tap back to accept and then again to go back to main Tasker menu -
Create your Home profile
a. From Tasker, tap the PROFILES tab
b. Tap the + at the bottom of the screen to create a new profile, then State, Plugin, AutoLocation, Geofences, Configuration Pencil. Tap Geofence Name, select Home - Arrival Boundary, then tap Status, Inside. Tap the check at the top of the screen to accept, then back
c. Tap New Task, leave name blank and tap the check mark. This will take you to the Task Edit window.
d. Tap + to add a new action, Task, Perform Task, tap magnifying glass, select Arrive [yourname] task. Tap the check mark at the top of the screen to accept. Scroll down to the If section, tap the + to add a new restriction. Set restriction as %[yourname] eq not present. Tap back to accept, then back until you get to the main Tasker screen.
e. Rename the profile - Long press on the profile name (it should be something generic like AutoLocation Geofences Geofences), tap the letter A at the top of the screen, enter Home, tap the check mark. -
Create your Away profile
a. From Tasker, tap the PROFILES tab
b. Tap the + at the bottom of the screen to create a new profile, then State, Plugin, AutoLocation, Geofences, Configuration Pencil. Tap Geofence Name, select Home - Departure Boundary, then tap Status, Outside. Tap the check at the top of the screen to accept, then back
c. Tap New Task, leave name blank and tap the check mark. This will take you to the Task Edit window.
d. Tap + to add a new action, Task, Perform Task, tap magnifying glass, select Depart [yourname] task. Tap the check mark at the top of the screen to accept. Scroll down to the If section, tap the + to add a new restriction. Set restriction as %[yourname] eq present. Tap back to accept, then back until you get to the main Tasker screen.
e. Rename the profile - Long press on the profile name (it should be something generic like AutoLocation Geofences Geofences), tap the letter A at the top of the screen, enter Away, tap the check mark.
f. Add your second profile state: Long-press on the AutoLocation state under the Away task, tap +, tap State, Variables, Variable value, set to %PACTIVE !~ [asterisk],Home WiFi Connected,[asterisk]. Tap back to accept -
Create your Device Shutdown profile
a. From Tasker, tap the PROFILES tab
b. Tap the + at the bottom of the screen to create a new profile, then Event, System, Device Shutdown. Tap back
c. Tap New Task, leave name blank and tap the check mark. This will take you to the Task Edit window.
d. Tap + to add a new action, Variables, Variable Set, Name %Rebooting to true. Scroll down to the If section, tap the + to add a new restriction. Set restriction as %PACTIVE ~ [asterisk],Near Home,[asterisk]. Tap back until you get to the main Tasker screen.
e. Rename the profile - Long press on the profile name, tap the letter A at the top of the screen, enter Device Shutdown, tap the check mark. -
Create your YourName Variable Set profile
a. From Tasker, tap the PROFILES tab
b. Tap the + at the bottom of the screen to create a new profile, then Event, Plugin, SharpTools, Thing State, Configuration Pencil. Enter Thing: [your presence sensor name], Attribute: presence, then tap Apply, then back
c. Tap New Task, leave name blank and tap the check mark. This will take you to the Task Edit window.
d. Tap + to add a new action, Variables, Variable Set, set %[yourname] to %st_attr_value. Tap back to accept, then back until you get to the main Tasker screen.
e. Rename the profile - Long press on the profile name, tap the letter A at the top of the screen, enter [yourname] Variable Set, tap the check mark.
Now that you have 6 new profiles, you may not want them all to show in your notifications tray. You can disable this by long-pressing on the profile name, tapping settings, then unchecking the Show in Notification Pulldown box. I did this for all of my profiles except Home.