Created At

Apr 23, 2020

Last Update

May 04, 2020


HC 3





Type Quick App

It is a Quick App to track presence based on the status of the device's MAC address in the UniFi controller. The app emulates a binary sensor. "Unknown" and "Home" correspond to the sensor's status "true", "Away" corresponds to the sensor's status "false".

The following variables are mandatory:

  1. controller - address of controller including protocol and port (e.g.,
  2. site - name of the site defined in controller and where MAC address will be searched (e.g., default)
  3. login - username to log into the controller. I recommend creating a dedicated user with read-only access to the controller (e.g., fibaro)
  4. password - self-explanatory
  5. frequency - how often to poll controller (in seconds, e.g., 120)
  6. mac - MAC address of the device that will be tracked (e.g., d4:a3:3d:c2:b9:e4) 

The following variables are optional:

  1. away delay - the app changes status for MAC address from "presence detected" to "presence not detected" if the UniFi controller "sees" the mac more than "away delay" seconds ago. If the variable is not defined, then the value of "frequency" is used as "away delay".

16 Comments,  Want to add comment please login

Hmmm... when i set frequency to 60 (instead of 3), it seems to work fine! Cheers!


Thx - i found out that although my site is called Site - unifi ip address points out it is called something like "g4szhqw4". When I use that as a variable - i can connect! BUT - I only get a "Home" once. After that, I receive "Away". So the first time it sees my iphone - it works. But the next poll leads to Away - althoug nothing has changed and my Iphone is still attached to the wifi network. Any suggestions?


I recommend sending a request manually to validate the app's configuration. To do that: 1) Open in web browser URL specified in the "controller" variable. 2) Login with the login/password from "login" and "password" variables. 3) In the same browser tab where you logged into UniFi, open the page <controller>api/s/<site>/stat/sta. In my configuration the "controller" variable is "", the "site" variable is "defaul", so the whole request looks like "". 4) The UniFi controller responds with the list of devices, including their MACs, which the controller "sees". 5) Search the response for the MAC address specified in the "mac" variable.


Nope - didn't find it. Error stays: [ERROR] [QUICKAPP390]: checkMacUnifi() failed: "{\"meta\":{\"rc\":\"error\",\"msg\":\"api.err.NoSiteContext\"},\"data\":[]}" Any Sugeestions?


Found it! It seems an iphone has a private MAC address config for each new Wi-Fi-network it connects to.