Tasker+Autolocation Presence Setup [Android Only]

Edited 12/21/21
Moving from ST to HE the most painful part was trying to figure out the presence of my phones. I could not find a solid answer on how to do this without using life360 and wanted to provide a simple guide on how to do this.
Feel free to add suggestions or corrections,
Apps Needed:
Virtual Presence Sensors
Hubitat API
Autolocation (buy it once, share with the family in google play store)
Tasker (buy it once, share with the family in google play store)

Virtual Presence Sensors

  1. In hubitat go to devices
  2. "Add Virtual Devices"
  3. Name the device of the person it will be monitoring
  4. Set the type to "Virtual Presence"
    Repeat for as many devices as you need

Hubitat API
If not already added, add the hubitat API under "built in apps"

  1. Go to "Select Devices"
  2. Add the virtual presence sensors you just added above
  3. Take note of the line " Send Device Command (replace [Device ID]..."under the "Cloud URLS"
    https://cloud.hubitat.com/api/...
  4. Click on the "Get All Devices" and take note of each device ID (used next step)
  5. Email yourself the URL and add the commands needed (see below)

arrived: https://cloud.hubitat.com/api/xxxxxxxx/apps/xxx/devices/[Device ID]/arrived?access_token=xxxxxxxxxxxxx

departed:https://cloud.hubitat.com/api/xxxxxxxx/apps/xxx/devices/[Device ID]/departed?access_token=xxxxxxxxxxxxx

By doing this, it allows tasker to set the mode when inside or outside the geofence.

Autolocation

  1. Go to "Manage Geofences"
  2. Add a geofence with the "+" sign on the top right
  3. Name it accordingly and save it
  4. Go to the "configure monitor"
  5. Make sure the settings look like the following:
    "Retrieve First Location" - Checked
    "Update Type" - Balance Power or High Accuracy, your choice
    "Interval" - 30 seconds
    All other fields I did not touch
  6. To save hit the "check mark" on the top right

Tasker - Monitor Settings
The below values need to be adjusted to better ensure reliability with this method

  1. Go to tasker and select "Preferences"

Display On Monitoring:
WIFI Scan Seconds - 120
GPS Check Seconds - 30
Network Location Check Seconds - 30
GPS timeout Seconds - 25

Display Off Monitoring:
All checks - 30
Timeout Seconds - 25

General Monitoring:
BT Minimum Timeout Seconds - 10
WIFI Minimum Timeout Seconds - 10

Tasker - Tasks

  1. Go to your email and copy the "arrived url" you sent earlier
  2. Add a task and name it "I'm Home"
  3. Click on the "+" sign (bottom right) and filter for "http"
  4. Select "HTTP Request"
  5. Method "GET"
  6. Under "URL" paste the "arrived url"

Tasker - Profile

  1. Add new profile and name it "Inside Geofence" (plus sign bottom right hand)
  2. Select "State"
  3. Select "Plugin"
  4. Select "Autolocation"
  5. Select "Geofences"
  6. Click on the pencil (top right hand)
  7. Select "Geofence Name"
  8. Select your geofence
  9. Select Status and choose "inside"
  10. Hit save (top right corner, check box)
  11. Add the "I'm home" task

From here it should be working. Now you need to follow these steps to add the "departed url to tell hubitat when you are not home. The only difference is for the geofence, you select "outside".
You will need to exclude autolocation and tasker from power savings in android to get better reliability.

I also used a similar method to check for wifi and update accordingly as a backup in case the gps did not work. I setup a http get response using the "local" API call rather than the cloud incase the internet was down. By adding a profile with the "state" of "WIFI connected" and kicking off the local API call this works. For not home I selected the same state but selected "invert" and that seems to work for the going away when I loose connectivity to my wireless.

Details on Backup Setup

  1. In Hubitat, add a virtual presence device and name it "Home Backup"
  2. Follow section labeled "Hubitat API" to find the URL of this device with "arrived"

In Tasker

  1. Add action first, name it "Wifi Home Backup"
  2. Click on the "+" sign (bottom right) and filter for "http"
  3. Select "HTTP REQUEST"
  4. Method "GET"
  5. Under "URL" paste the "backup arrived url"
  6. New profile
  7. State
  8. Net
  9. Wifi Connected
  10. Find your network the phone connects to (SSID)
  11. Active -> Yes
  12. Link this profile to the above task

For "Not Home" follow the above steps and "invert it" (create another profile with the same steps but set "active no") with "departed url" instead.

I hope this helps someone down the road and if you have any suggestions respond in the comments.

11 Likes

Thanks for this. I've got this set up and working.

Is this the same as the Maker API?

Yes, the OP is referring to the Maker API app.

2 Likes

Thank Ogiewon :slight_smile:

2 Likes

Which tasker app? Pretty sure I don't want the one by Task Rabbit?

Download the Hubitat app