[HOW TO] SmartThings Presence reporting using Tasker/SharpTools/AutoLocation

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

  1. 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)
  2. 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”
  3. 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
  1. 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

  1. 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.

  2. Install all three apps on your phone. The rest of the steps below assume that you have the full paid version of the apps.

  3. 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.

  4. 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.

  5. 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

  6. 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

  7. 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

  8. 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

  9. 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

  10. 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

  11. 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.

  12. 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

  13. 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.

  14. 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.

26 Likes

Great write-up! Do you mind if I link to this write-up from the SharpTools article about custom presence?

1 Like

Absolutely! I’m going to be adding some screeshots as well. If you see anything that doesn’t look right or needs additional information presented, please let me know.

I also added your link to my post. I didn’t realize you had a writeup on this already :slight_smile:

It looks great so far! You’ve done a great job breaking it down with a solid introduction explaining the who, what, and why before jumping into the step-by-step instructions! I’ve added a link to this write-up at the top of the SharpTools Custom Presence article.

One thing I’ve seen before is the commands to control SmartThings can get dropped if they are triggered while you are transitioning from cellular to wifi (or vice versa), so I’ve seen some users add retry logic like this post from @hellfire51:

2 Likes

Good to know, thanks for the link and heads-up :slight_smile:

Hmm, followed every step, and every profile is working and turns green when at home, except the final “Home” profile. What’s weird is that, if I invert the Home profile, it kicks on and says I’m present. What could I be doing wrong to invert it?

I named everything the same, it says %PACTIVE on the left, matches symbol in the middle, and then * Home-WiFi / * Home-Location * without any spaces.

When I choose to invert it, it kicks on and the virtual sensor turns to present. Obviously, that’s not the way it should work though as those other profiles ARE active.

Can you post some screenshots of your profiles and the %PACTIVE condition settings?

Sure. Here’s the main profile screen and the four profiles. Thanks for taking a look. I’m sure it’s operator error somewhere along the way. This is the non-inverted, non-working version.

Something doesn’t look right with your Home profile, it’s not showing the Variable state. Here’s what mine looks like for comparison…

Ah, I had just accidentally renamed that part. I went ahead and redid it completely, but it still doesn’t work unless I invert it. Here it is normal and not working when it should.


And here it is inverted and working…

So I just created two new profiles to test, one called Test that was active when connected to wifi, the other that was active when %PACTIVE matched * Test *. I tried disconnecting and reconnecting wifi and the second one relying on %PACTIVE wouldn’t show active, until I force stopped and relaunched Tasker. Now it seems to be recognizing correctly. Try that with yours. Let me know if it works so I can update the instructions above.

I also inserted a new Step 4. My wife’s phone didn’t register as being home when she arrived this afternoon, even though the Tasker profiles on her phone were activated correctly. I had these options set in my phone but not hers, figured that maybe that was the problem. I left and came back with her phone after changing and it reported home correctly.

After running your test and having it succeed, I figured out the minor but fatal user error I had made. When renaming the profiles, I didn’t rename them by long clicking on the profile name itself, but rather renamed the state that triggers the profile. Your instructions were clear, I just didn’t follow them close enough! Once I redid the profiles and named them appropriately, it fired correctly.

Thanks for walking through it. You basically identified the error when you pointed out my Home profile looked wrong. I just needed to fix the renaming on all of them!

1 Like

Chris,

Once again, this is fantastic. I’ve put it all together and now I just need to come and go to test it. While it’s fresh in my mind, here are some comments I noted along the way - nothing major because your instructions are great.

(5g) I think when you added P4, you didn’t update the instructions to repeat #5 (not #4)

(7a & 9a &12a) For newbies, it would help to clarify it’s the task not the profile that needs to be held. You say it, but the difference can be nuance (easy to miss).

(8c) Useful to note that the magnifying glass will give easy-to-click SSID selection

(11i, 12f) Maybe this is just me, but SharpTools always has a looong delay (15s) to initialize, seems like it crashes but if I wait it finally appears. If that’s the case for others, maybe a useful note to be patient.

And, a question… (8B) why do you use “Wi-Fi connected” instead of “Wi-Fi Near”?

Thanks again!!!

1 Like

Thanks for the notes, I edited my instructions per your comments. Regarding 11i and 12f, it comes up instantly for me. Does anyone else see a long delay when selecting a SharpTools task?

As for 8B, I am using WiFi Connected because it’s state updates instantly when I connect or disconnect from my network. WiFi Near scans available networks every 2 minutes (this is the default setting in Tasker, but it’s changeable), so the updates are not quick enough for me. Might work for others though.

On edit - I just looked through some of the available Tasker actions, and it looks like you can set the wifi scan period through a profile. I’ll play with this a little later and see if it’s a better fit than WiFi connected.

As a side note, my phone (Droid Turbo 2) is working well as set up in the steps above. I am still tweaking my wife’s phone (HTC M9), it seems to be fond of checking her in as present about a minute after she gets home. I’m trying different sizes for the outer geofence, and also decided to try to exclude Tasker, AutoLocation, SharpTools, SmartThings, and HTC Location Services from Battery Optimization to see if any of those things helps. I’ll add a few notes detailing these changes once I find a combination that works well for her phone.

1 Like

I think I found the issue with my wife’s HTC One M9. There’s a setting in her Advanced Wifi settings to Optimize Wifi, which essentially means to put it to sleep when not in use. I unchecked that box and tested 4-5 arrivals and it’s working much better now. I was able to take her outer geofence radius from 2000m down to 1500m. I don’t have that option on my Droid Turbo 2, so I’m guessing they leave wifi awake all the time. According to the AutoLocation FAQ, wifi needs to be on in order for geofencing to work correctly, so hopefully this is the cause of the problem I was seeing. If her’s continues to cause problems, I may add a third “way-outer” geofence with something like a 5000m / 3 mile radius that does location updates every 3 minutes or so.

After fixing that issue on her phone, I noticed that while High Accuracy location would enable correctly when inside the outer geofence, Tasker wouldn’t actually fire the SharpTools “arrived” command until I turned the screen back on. I had to mess with the Screen Off All Checks and Timeout Seconds settings. The default is All Checks 600 seconds and Timeout 60 seconds. I added tasks to change Tasker Prefs to All Checks 30 seconds and Timeout 25 seconds in all of the profiles that enable high accuracy location, and set those same values back to default in all of the tasks that disable high accuracy location.

The other strange thing that her phone does is use GPS full time when high accuracy mode is on. Her battery life kinda sucks anyway, and this makes it much worse. I don’t think my phone is doing that, I usually get a satellite dish in my notification bar when GPS is active, but I haven’t seen that a single time when Location Monitor is enabled. I ended up changing her location type to Balance Power/Accuracy instead of High Accuracy and it still seems to work ok, at least with the limited testing I did. GPS symbol is gone from her notification bar, so hopefully this will solve the battery drain issue on her phone.

Revisiting Near WiFi as well…I tried setting this up on my phone and initially it did not seem to ever deactivate the profile once active. Did a little bit of reading and saw that a network doesn’t get “forgotten” until it goes two consecutive scans without seeing it, which could be up to 6 minutes with the default 120 second scan period depending on when the last scan was done. I wasn’t happy with how long that might take to deactivate, but again, this is a setting that is configurable as part of a task. So…here’s what I now have on my phone, haven’t done a lot of testing but the two times I’ve come and gone today it worked:

Near Home Profile activates when inside my outer geofence. Entry task turns AutoLocation Location Monitor on to High Accuracy mode. Exit task turns AutoLocation Location monitor off.

Home-WiFi profile activates when I am connected to my home wifi network. Entry task turns AutoLocation Location Monitor off and sets Tasker Wifi Scan Period to 120 seconds (default). Exit task turns AutoLocation Location Monitor On to High Accuracy mode and sets Tasker Wifi Scan Period to 25 seconds (minimum allowable).

Home-NearWiFi profile activates when I am near either my primary home wifi network (router is near the back of the house) or near my wireless bridge (router is near the front of the house). I did this because occasionally my phone will disconnect from wifi when I’m out in the driveway since the signal is weak out there. I also referenced these two networks by mac address instead of SSID in case my phone ever sees another wifi network with the same name while I’m out. I do not have an entry task for this profile. Exit task sets Tasker wifi scan period to 120.

Home-Location profile activates when I enter my inner geofence. Only task associated is a dummy wait task.

Home profile activates when any of Home-WiFi, Home-NearWiFi, or Home-Location profiles are active, using the %PACTIVE variable. Entry task uses SharpTools to make me arrive, and I have a second task that opens my garage door if my car’s Bluetooth profile is also active. Exit task uses SharpTools to make me depart.

The normal sequence of event when coming home now looks like this:

  1. When I cross into my outer geofence, Near Home is activated and Location Monitor turns on to High Accuracy mode
  2. When I cross into my inner geofence, Home-Location is activated. Since this is one of the three profiles that can activate the Home profile, it also activates and tells SharpTools that I have “arrived” in SmartThings. Additionally, if my phone is connected to my car’s bluetooth, an additional SharpTools command is sent to open the garage.
  3. When I connect to my home WiFi network, Location Monitor is turned off
  4. At some point after I arrive home (timing isn’t significant), my Home-NearWiFi profile activates. No action taken at this point.

The normal sequence of events when I leave home now looks like this:

  1. When I leave home and disconnect from my home WiFi network, Home-WiFi deactivates, Location Monitor turns on to High Accuracy mode and Tasker is set to rescan wifi networks every 25 seconds
  2. When I leave my inner geofence, Home-Location profile deactivates, with no action taken
  3. After 2 scans without being near one of my wifi networks, my Home-NearWiFi profile deactivates (usually around a minute after leaving the area). Wifi scan period is reset to the default 120 seconds. Since all three of the profiles that are referenced in the Home profile are now deactivated, Home is deactivated, and SharpTools tells SmartThings I have departed.
  4. When I leave my outer geofence, Location Monitor is turned off.

I tried setting up the Wifi Near on my wife’s phone but ran into the same problem where it wouldn’t deactivate, even with the scan period set to 25 seconds. At this point I was tired of tweaking stuff, so I gave up and deleted all of the references to “wifi near” on her phone. Might play with it again later, but both of us are tired of me stealing her phone to tweak stuff for an hour at a time :slight_smile:

1 Like

I’ve implemented your last changes, with the exception of the garage door. I really appreciate the description of the logic flow you added at the end - helps me understand what’s happening.

I’ve worked up the retry logic that @joshua_lyon suggested for the Home profile tasks. Do you think that’s useful? Do you think it’s possible that it might in some way corrupt your logic? I’ll post a pic of it tomorrow.

No problem, hope it works ok for you.

I haven’t really looked at the retry logic yet, haven’t had any issue with commands being dropped.

Thanks so much for the write up, the instructions were great! Clear, concise and I was able to get it working. I was even able to see my first mistake and correct it immediately thanks to a response!

1 Like

Wow! This is amazing work here.
Thank you, very much, for putting it all written out like that. It really helps us detail-oriented, linear types.

I will be giving it a try sometime soon…

1 Like

Thank you for this! I was using IFTTT but that seems a bit unreliable for my particular needs. As previously mentioned your instructions were clear and concise and worked right out of the gate when tested with GPS Emulator :slight_smile:
-Rob

1 Like