SmartThings Community

[RELEASE] Improved Mobile Presence (Android only)

android
presence
dth_presence
project_presence
webcore

#1

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:


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 are updating your Device Handler and SmartApp, start at Step 3 (You will need to remove any existing devices that were manually created using the old method… sorry :slightly_frowning_face:)

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: Setup GitHub integration

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

  1. Select Settings from the top right corner
  2. Click Add new repository
  3. Enter the following information:
    a. Owner: Johndc7
    b. Name: Smartthings
    c. Branch: Master
  4. Click Save

Step 3: Install SmartApp and Device Handler

  1. Click My SmartApps
  2. Click Update from Repo then Smartthings (Master)
  3. Install Presence Sensor
  4. Check Publish and click Execute Update
  5. Click My Device Handlers
  6. Click Update from Repo then Smartthings (Master)
  7. Install Improved Mobile Presence
  8. Check Publish and click Execute Update

Step 4: 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 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 select Marketplace
  2. Select SmartApps from the top of the screen
  3. Select My Apps from the bottom of the list
  4. Select Presence Sensor and click Save

Step 6: Pair devices

  1. Select Automation from the SmartThings app
  2. Select SmartApps from the top of the screen
  3. Select Presence Sensor (If Presence Sensor is missing, see step 4)
  4. Select New Device or Existing Device
  5. Choose a pairing option based on the following options
    a. Pair this device: Pair the device you are currently using
    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

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:


Google Assistant

As this is the initial release of this feature, it does not currently have much functionality. If you have any suggestions or issues please let me know.
Google assistant integration is currently in beta. Currently you can use this to see the location of a device in your SmartThings location. For example if you had a device named Fred, you could locate Fred by saying “Ok Google, Ask presence sensor where Fred is”. This requires that you have the updated SmartApp and device handlers installed. You can opt in to the beta here.


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

Device Handler

SmartApp

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


Anyone using connecting/disconnection from WiFi as a presence sensor
Mobile presence using wifi only
Broken presence in iOS and Android - what's the deal?
Fix for Android presence arrival problems
Ideas/suggestions for presence detection?
Wi-Fi Presence App?
(Chris ) #2

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?


#3

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


#4

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


#5

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.


#6

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


#7

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!


#8

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


#9

Thanks, let me know what you think about it.


(Bob) #10

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.


#11

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.


(Bob) #12

Thanks. It looks good so far.


#13

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


(Jason) #14

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.


#15

Ok thanks, I’ll try to change that later today.


(Bob) #16

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


#17

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


(Bob) #18

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


#19

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.


(Jason) #20

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.