Home

Awesome

Introduction

UniFi-Lab is collection of utilities that aims to help managing UniFi controller. UniFi-Lab interacts with UniFi controller through cURL, which is like a text-version browser, and is controlled by python scripts. You can think of UniFi-Lab as a robot IT that always monitors the controller and takes actions when needed.

These version is using UniFi API interface. For example have please have a look at Jakob Borg's unifi-api for Python (https://github.com/calmh/unifi-api).

Features

MAC Addresses White List

The UniFi controller will block any MAC that is not on the list. You can alse configure SSID where MAC will be NOT blocked ("Guest WiFi").

Poor Signals Reconnect

The UniFi controller will kick (aka reconnect) any stations that fall below assigned RSSI (or Signal Strength, depends on the configuration) threshold for assigned period. The idea is that, by forcing a station to reconnect, the station often goes to an AP with better signals to its eyes, therefore gets better performances.

This feature can also be used as blocking those stations below certain RSSI if the duration threshold is set to 1 second. This won't completely shut off a station since the station still can connect for 1 second before gets kick, but it surely will be very annoying and close to unusable wireless. We cannot simply block a station every time it falls below a threshold. If we do that, we then have no idea when the station is back into the range. At this moment, only a connected station can be told RSSI on controller, it is a chicken and egg problem.

AP Periodic Reboot

The controller will reboot selected APs on the specified days and time.

Prerequisites

The UniFi-Lab utility needs to interact with the UniFi controller, therefore '''UniFi controller must be up and running'''. It also needs these two software installed

Below we demonstrate installation steps in different operating systems.

Debian 6.0

Windows

Mac

Download

UniFi-Lab can be downloaded from here.

There are four files included in the UniFi-Lab,

Installation for Manual run

Create a directory and put above files under it. Copy '''unifi_lab_production.ini''' to /etc/unifi_lab/unifi_lab.ini and modify for your environment

Install unifi-api interface (https://github.com/calmh/unifi-api)

For Windows, make sure that curl.exe is also under the same folder.

Execution

Modify the config file first according to your needs and environment. Then, in CLI, go to the directory, run "'''python unifi_lab.py'''" to start. To stop, press "Ctlr-C". If you change the config file while running, you also need to restart the UniFi-Lab to reflect these changes.

Installation of Debian init scripts

The following was tested on Debian 6

Now you can use /etc/init.d/unifi_lab start|stop|restart

Configuration

The '''/etc/unifi_lab/unifi_lab.ini''' file contains the related parameters of UniFi-Lab features. Lines that start with ; are comments.

[General] Section

The [General] section does not need changes unless you want your log or pid files in another location or with a different name

[Controller] section

You must fill in the [Controller] section to point to your UniFi server. These set controller ip address, login id, password, port and version

[Mail] section

Use the [Mail] section to configure email alerts

[Feature] section

This section enables or disables unifi_lab features. Use "True" or "False" values (Note: values are case sensitive)

MAC addresses white list feature

There are no other parameters for MAC_AUTH. The white list file "unifi_lab_mac_auth.list" has allowed MAC addresses. One MAC address per line. The UniFi-Lab will ask the controller to block any MAC that is not on the list. The white list file can be changed on the fly (meaning the UniFi-Lab reloads file constantly)

Poor signals reconnect feature

For Periodic Reboot feature

Notes

MAC Addresses White List

POOR_SIGNAL_RECONN

SSID On/Off Scheduler

AP Periodic Reboot