This project allows presence detection at multiple locations (Work / Home / etc.) and syncs some other additional info like battery and power source so they can be used in automations. Updates are real time (usually under a second) and setup is pretty straight forward.
Setup Instructions
This is currently availible on Hubitat Package Manager. If using HPM then skip to step 5
If you need to add pair an additional device after already completing these instructions, see Step 5
Step 1: Install Presence Sensor Android 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)
If you are using Android 8.1 or above you need to install the patch AND the app from Google Play
To update to the most recent patch, you must uninstall the old patch first
Patch
Make sure you open the patch app or it will not work
Step 2: Copy app and driver from GitHub
- Copy the app and driver into the Apps Code and Drivers Code pages on Hubitat
- Make sure to enable OAuth using the OAuth button in the app code editor. You don't actually need to do anything with the info. Just make sure it's enabled.
Step 3: Install App
App should only have one instance in Hubitat otherwise it can cause issues with syncing.
- Select Add user app from the Apps tab
- Select Presence Sensor
Step 4: Install app
Do NOT install multiple copies of the app as it can cause problems when syncing data.
- Select Add User App from the Apps page on Hubitat
- Select Presence Sensor and then Save
Step 5: Pair devices
Make sure you saved the app in step 4. When the app is saved, is syncs authentication data. If you do not save first, you will get errors when pairing your phone.
- Open the Presence Sensor app in Hubitat
- Select New Device
- Enter a name and select either Pair this device or Pair another device.
- If you selected pair other device, scan the QR code with the Presence Sensor app on your phone. If you selected pair this device, the Presence Sensor app should open automatically. The device will be created in Hubitat automatically with either option.
Step 6: Create Locations in Presence Sensor app
- Open Presence Sensor app on your phone
- 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.
Device Attributes
The device driver has the following attributes that can be used is custom automations.
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
How to setup locations in the app
- Locations have Wifi and Bluetooth triggers
- 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. - 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
Download Links
If you are using Android 8.1 or above, you need to install the Presence Sensor app and the Patch
FAQ
- Are you running servers to support the functionality of this app?
- Yes but no personally identifiable information is ever sent to or accessible by the server. No past events are logged or stored. That is communicated to the server is:
- Device ID (you can see this in the app settings)
- Name of current location (Wi-Fi / Bluetooth data is processed locally on your device - only the name of the location is sent)
- Battery percentage
- Power source
- Authentication info to use the Hubitat API
- Yes but no personally identifiable information is ever sent to or accessible by the server. No past events are logged or stored. That is communicated to the server is:
- I'm getting "Update Error" notifications.
- Update error #1 - Error in the app
- Error in the Android app before attempting a connection
- Update error #2 - Error connecting to the server
- This usually happens if your device does not have internet or if the app tried to sync while your device was switching between networks. The app will retry the connection. Unless you get this a lot and don't see data going to Hubitat, this can be ignored.
- Update error #3 - Error on the server
- Usually this happens because the server does not have the necessary info to authenticate to the Hubitat API. Open the app in Hubitat and click save. This will refresh the authentication info stored on the server. If you still have issues, try to pair the app again.
- Update error #1 - Error in the app
- I have an iPhone. Does this work?
- No, there is no version of the app for iPhones. Developer accounts for the App Store are kinda expensive, it would require a complete rewrite of the app and I do not have (or plan on getting) an iPhone.
- Why do I have to install the patch app?
- Because starting in Android 8.1, it's not possible for an app to be notified when the Wi-Fi state changes. The patch app targets a lower version of Android and just relays the information to the main app.
Donate
Donations are not required but are greatly appreciated. If you would like to donate, click the link below.
Donate