[OBSOLETE] Improved Mobile Presence (Android only)

Improved Mobile Presence

This project is a mobile presence system with additional features and improved speed / reliability. I started working on this after having many frustrations with the built in mobile presence system and battery issues with the arrival sensor. I am open to any ideas or suggestions and check this thread often so let me know what you think. :slight_smile:


Changes currently in beta

  1. Locations now have Wifi and Bluetooth triggers (Geofencing option coming soon)
  2. Triggers have the following options:
    a. Negative: Inverts the trigger (Ex. Wifi is not HomeWifi or Bluetooth device is not connected.)
    b. Requirement: If requirement is checked, the trigger is required for location to be active but does not place you in that location by its self.
  3. Power source changes now update in real time (patch update required).

A few examples:

Wifi is HomeWifi
Wifi is HomeWifi5
Bluetooth is SmartWatch (requirement)

Scenario 1 (At home):

Wifi is HomeWifi - false / ignored
Wifi is HomeWifi5 - true
Bluetooth is SmartWatch (requirement) - true / ignored
Result : Present

Scenario 2 (Out running, left phone at home and wearing watch):

Wifi is HomeWifi - false / ignored
Wifi is HomeWifi5 - true
Bluetooth is SmartWatch (requirement) - false
Result : Not Present


Setup Instructions

This process has been changed to make it easier to add new devices and eliminate confusion in the setup process. Feedback is welcome.

If you need to add pair an additional device after already completing these instructions, see Step 6

Step 1: Install Presence Sensor app

Accept any prompts to ignore optimizations (If you do not do this the app will be blocked from communicating with the server so it will not work)

Get it on Google Play

If you are using Android 8.1 or above you need to install the patch AND the app from Google Play
Patch

Make sure you open the patch or it will not work

Step 2: Copy SmartApp from GitHub

SmartThings IDE can be accessed at https://account.smartthings.com

  1. Log into the SmartThings IDE
  2. Click My SmartApps
  3. Click New SmartApp
  4. Click From Code
  5. Paste the SmartApp code from GitHub and click create
  6. Click Publish then for me.

Step 3: Enable OAuth

  1. Click My SmartApps
  2. Click the edit icon next to Presence Sensor
  3. Click on the OAuth Section
  4. Make sure OAuth is enabled and you have a Client ID and Client Secret

Step 4: Copy Device Handler from GitHub

SmartThings IDE can be accessed at https://account.smartthings.com

  1. Click My SmartApps
  2. Click New Device Handler
  3. Click From Code
  4. Paste the Device Handler code from GitHub and click create
  5. Click Publish then for me.

Step 5: Install SmartApp

If you are updating and already have the SmartApp installed, skip this step. Do NOT install multiple copies of the SmartApp as it can cause problems when syncing data.

  1. Open the SmartThings app and go to the Automations tab at the bottom of the screen.
  2. Select Add SmartApp
  3. Select Presence Sensor and click Done

Step 6: Pair devices

  1. Select Automations from the SmartThings app
  2. Select Presence Sensor
  3. Select New Device or Existing Device
  4. Choose a pairing option based on the following options
    a. Pair this device: Pair the device you are currently using. This option only works in the SmartThings Classic app.
    b. Pair another device: Displays a QR code to be scanned by the Presence Sensor app on another device

Step 7: Create Locations in Presence Sensor app

  1. Open Presence Sensor app
  2. Click on a location to edit or click the add button to create a new one
    a. Name: Location name
    b. Home location: If checked, you will show as present when at this location
    c. Networks: Connecting to any of the checked networks will cause you to show that you are at this location

If you are setting up additional devices, repeat steps 6 and 7 until you have setup all of your devices.

Everything should be working now

If you have any questions about this process or any other issues let me know.


WebCore

_More information about WebCore can be found at https://community.webcore.co/_

This project works with WebCore and has the following attributes
a. currentLocation: The location where you currently are
b. previousLocation: The last location you were
c. presence: present if at a home location or not present if anywhere else
d. battery: Battery percentage of phone
e. powerSource: battery if not charging or dc if charging

For example, To set the thermostat to 70 degrees when you leave work you could do this:


Download Links

Must have app from Google Play and device handler installed
If you are using Android 8.1 or above, you need to install the Presence Sensor app and the Patch

Presence Sensor App
Get it on Google Play


Donate

Donations are not required but are greatly appreciated. If you would like to donate, click the link below.
Donate

22 Likes

Sounds perfect! I was using something on custom asuswrt but was a work around.

Will it work if have large setup with multiple bands and access points?

As long as itā€™s all the same SSID.

Currently you can only set one network as your home network but Iā€™ll be adding support for multiple networks some time in the next few days. If you have any problems or questions about anything let me know

Edit: Now supports multiple network ssid

How does this compare with the method below
[HOW TO] SmartThings Presence reporting using Tasker/SharpTools/AutoLocation

Just reading through that it looks like that still uses GPS. This doesnā€™t use GPS at all and donā€™t have much if any effect on battery life. This is only triggered by Android when your WiFi connection changes. So this is completely WiFi based.

But what if you wifi goes down in your home and switches to data.

Hi.
I just wanted you to know that I consider this a superior method of presence detection, and Iā€™m trying it out. Iā€™ll let you know after I try it out for a few days. Thanks for the effort!

If your WiFi goes down SmartThings wonā€™t be working anyways. But the app would say not present.

1 Like

Thanks, let me know what you think about it.

Just installed this and will test it. It looks goodā€¦
Just a couple of questions.
When I disconnect the WiFi it says false.
What does it mean.
What is the timeout for and is it seconds or minutes.

1 Like

If your talking about the notifications, those are mostly for debugging purposes. When it says false itā€™s probably setting your presence to not present.

The timeout is there if you want to wait for a certain amount of time before it changes to not present. That should be at 0 unless you start to have problems with your WiFi disconnecting or something. The timeout is in minutes.

Thanks. It looks good so far.

Let me know if you have any issues or ways to make it better.

Does the timeout only apply to setting the sensor Not Present?

Two styling notes; Having the Device ID font larger in the Android app. More notes in the SmartThings settings of the sensor that Timeout is minutes, and what it applies to.

Ok thanks, Iā€™ll try to change that later today.

Just an update for you.
I havenā€™t actually left home today so cannot comment on that part.
I have observed this though.

Phone connected to WiFi.
Presence shows as present in ST app.

WiFi turned off on phone.
Notification received on phone. ā€œYour presence has been set to falseā€.
Presence in ST app shows ā€˜Presentā€™. Nothing in the recently tab.
The following in the IDE logs.
32abd4b5-2f94-48f7-931f-a4204d3b138e 18:15:38: debug leftCounter: 271
32abd4b5-2f94-48f7-931f-a4204d3b138e 18:15:38: debug setPresence(false)
32abd4b5-2f94-48f7-931f-a4204d3b138e 18:15:38: debug Recieved ā€œfalseā€ from server
32abd4b5-2f94-48f7-931f-a4204d3b138e 18:15:38: debug Checking presence

WiFi turned back on on the phone.
Notification received on phone. ā€œYour WiFi is disconnectedā€. Followed by ā€œYour presence has been set to falseā€.
Presence in ST app shows ā€˜Presentā€™. Nothing in the recently tab.
The following in the IDE logs.
32abd4b5-2f94-48f7-931f-a4204d3b138e 18:15:38: debug leftCounter: 272
32abd4b5-2f94-48f7-931f-a4204d3b138e 18:15:38: debug setPresence(false)
32abd4b5-2f94-48f7-931f-a4204d3b138e 18:15:38: debug Recieved ā€œfalseā€ from server
32abd4b5-2f94-48f7-931f-a4204d3b138e 18:15:38: debug Checking presence

Update your device handler. Forgot to update GitHub after I fixed that.

OK did that.
WiFi turned off on phone.
Notification received on phone. ā€œYour WiFi is disconnectedā€ followed by ā€œYour presence has been set to falseā€.
Presence in ST app shows ā€˜Presentā€™. Nothing in the recently tab.
The following in the IDE logs.
32abd4b5-2f94-48f7-931f-a4204d3b138e 18:15:38: debug leftCounter: 271
32abd4b5-2f94-48f7-931f-a4204d3b138e 18:15:38: debug setPresence(false)
32abd4b5-2f94-48f7-931f-a4204d3b138e 18:15:38: debug Recieved ā€œfalseā€ from server
32abd4b5-2f94-48f7-931f-a4204d3b138e 18:15:38: debug Checking presence

WiFi turned back on on the phone.
Notification received on phone. ā€œYour WiFi is disconnectedā€. Followed by ā€œYour presence has been set to falseā€.
Presence in ST app shows ā€˜Presentā€™. Nothing in the recently tab.
The following in the IDE logs.
32abd4b5-2f94-48f7-931f-a4204d3b138e 18:15:38: debug leftCounter: 272
32abd4b5-2f94-48f7-931f-a4204d3b138e 18:15:38: debug setPresence(false)
32abd4b5-2f94-48f7-931f-a4204d3b138e 18:15:38: debug Recieved ā€œfalseā€ from server
32abd4b5-2f94-48f7-931f-a4204d3b138e 18:15:38: debug Checking presence

What version of android are you running and what device? Check Google Play to make sure your app is updated since I updated it yesterday. Make sure you are connected to your home WiFi and hit the refresh server button in the app.

Would you add the Sensor capability?

capability ā€œSensorā€

The presence sensor wonā€™t show up in Action Tiles without it. I added it manually and it shows up now.