https://github.com/rfpludwick/unifi-phantom-clients-cleanup
Application to clean up phantom clients in the UniFi Controller
https://github.com/rfpludwick/unifi-phantom-clients-cleanup
go golang unifi unifi-controller
Last synced: about 1 year ago
JSON representation
Application to clean up phantom clients in the UniFi Controller
- Host: GitHub
- URL: https://github.com/rfpludwick/unifi-phantom-clients-cleanup
- Owner: rfpludwick
- License: apache-2.0
- Created: 2020-05-11T03:17:09.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2025-02-22T01:15:35.000Z (over 1 year ago)
- Last Synced: 2025-02-22T02:24:32.106Z (over 1 year ago)
- Topics: go, golang, unifi, unifi-controller
- Language: Go
- Homepage:
- Size: 34.2 KB
- Stars: 3
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# README
This is a simple application I wrote which cleans up phantom clients in the
[UniFi Controller](https://help.ui.com/hc/en-us/sections/360008076434-Using-the-UniFi-Network-Controller).
I've been having problems over the past couple years with my UniFi Controller
registering "phantom" clients. These clients have random MAC addresses and have
no network activity. They just appear. I'm not the only one with this problem:
- [https://www.reddit.com/r/Ubiquiti/comments/edpia4/unknown_devices_appearing_in_client_list](https://www.reddit.com/r/Ubiquiti/comments/edpia4/unknown_devices_appearing_in_client_list/)
- [https://www.reddit.com/r/Ubiquiti/comments/9bdu8s/unknown_mac_addresses_in_unifi/](https://www.reddit.com/r/Ubiquiti/comments/9bdu8s/unknown_mac_addresses_in_unifi/)
I run Docker containers within my home network for various functions, including
[Home Assistant](https://github.com/rfpludwick/home-assistant-config). I believe
these phantom clients are a result of that setup. And a byproduct of these
phantom clients is that, since I'm running Home Assistant and have integrated it
with my UniFi Controller, these clients make their way into my Home Assistant
entities. Manual cleanup in **both** systems is extremely tedious and annoying.
I have also heard these phantom clients can be caused by hardware running iOS.
Thus, this project. It was my first project in Go, so please, don't judge me too
harshly; I know some of the approach here is pretty simplistic. All it does is
logs in to the UniFi Controller, gets the list of clients, and checks them for
any network activity or custom name. If they have no network activity and no
custom name, then they are summarily removed from the UniFi Controller.
If you want to use this, by all means, but I take no responsibility if it causes
problems with your UniFi Controller. Just download the source, build it for your
target, and run it. It'll need a configuration JSON (defaults to reading
`configuration.json` in the same directory as the executable), and you can see
the default distribution configuration JSON at `configuration.dist.json`. YAML
is supported as well.
Invoke it so (Linux example here):
```shell
./
```
That's it. It implements *flag* as well, so if you want to see what options
are available:
```shell
./ -h
```