Integration for SmartThings to use UniFi wireless clients as presence sensors This will allow you to select from a list of known UniFi wireless clients to monitor their presence. By selecting device(s) to monitor, a script will run every 5 seconds to check the UniFi controller's current status of the monitored device(s). If the device can't be seen by any UniFi Access Point, then the device is reported offline. A device is "offline" when it is not connected to an UniFi wireless network.
You can also monitor guest connected to a UniFi hotspot by enabling the guest option.
These instructions will help you get this solution implemented. I'm going to assume a working local UniFi Controller already exist on the network.
Here are the things that we will need to install / configure
- UniFi Bridge (REST API server to facilitate communication between SmartThings and the UniFi Controller)
- This can be installed from here
- UniFi Wireless Presence (SmartThings SmartApp)
- UniFi Presence Sensor (SmartThings Device Handler)
First things first. Get the UniFi Bridge up and running before proceeding
There are two ways you can install the SmartThings SmartApp and Device Handler.
- VIA the SmartThings IDE GitHub integration
- Owner = xtreme22886
- Name = SmartThings_UniFi-Presence-Sensor
- Branch = master
- VIA copying / pasting the code in the SmartThinge IDE
- SmartApp = unifi-wireless-presence.groovy
- Device Handler = unifi-presence-sensor.groovy
Instead of describing the two methods of installation here, I'm going to refer you to the documentation for installing the SmartThings Community Installer as it's well laid out. You will need to be familiar with "Installation" section, specifically installing from code, installing from GitHub and OAuth setup.
Setup Steps:
- Install SmartApp
- Make sure to
Publish
and enabledOAuth
for this app
- Make sure to
- Install Device Handler
- Make sure to
Publish
this device handler
- Make sure to
- In the SmartThings Classic mobile app
- Automation > SmartApps > Add a SmartApp
- My Apps > UniFi Wireless Presence
- Enter in information for Bridge Address, UniFi Controller Address, UniFi Controller Username, UniFi Controller Password and UniFi Controller Site
- Click Save all the way out of the SmartApp
NOTE: The UniFi Controller Site is NOT the name of the site but rather the id of the site. Take "https://x.x.x.x:8443/manage/site/default/dashboard" as an example; the site id is what is listed directly after /site/. In this cause, it would be default.
After setup has been completed, we can begin to monitor device(s)
- Go back into the SmartApp
- Click on UniFi Client List
- Wait 5 seconds for the list of wireless clients to refresh and populate
- Click on
Tap to select
- Select the device(s) you want to monitor
- Click Save all the way out of the SmartApp
- Go back to your list of Things and locate the new presence device that was created
- Feel free to rename this device as needed
Notes:
- Anytime you add/remove devices to be monitored, the SmartApp with add/remove the associated thing