ispserverfarm/unifi-meshviewer-generator

Der Meshviewer Generator erzeugt die erforderlichen JSON Files zur Einbindung von Unifi AccessPoints, die mit der Stock Firmware über den Unifi Controller verwaltet werden. Der Generator holt mittels API die entsprechenden Daten vom Unifi Controller

1.1.0 2020-07-05 11:05 UTC

README

Der Unifi Meshviewer Generator verbindet sich per API mit dem Unifi Controller (z.B. dem Cloudkey) und ermittelt alle AccessPoints. Aus den Daten wird eine meshviewer.json und eine nodelist.json erzeugt. Diese können anschließend im Meshviewer und der Nodelist zusätzlich eingebunden werden. Somit sind auch Unifi AccessPoints die mit der Stock Firmware an einem Unifi Controller betrieben werden, zukünftig auf der Freifunk Map zu sehen. Dieses Projekt basiert auf der Idee von Freifunk-Greifswald/UniFi.php, vielen Dank für den Ansatz.

The GitHub repository is only a mirror of our GitLab

Requirements

  • a web server with PHP and cURL modules installed (tested on Apache 2.4 / NGINX with PHP Version 5.6.26 and cURL 7.42.1 and with PHP 7.2.10 and cURL 7.58.0)
  • network connectivity between this web server and the server and port (normally TCP port 8443) where the UniFi Controller is running.
  • Git
  • Composer

Installation

You can use Git or simply Download the Release to install this webservice.

Git

The preferred method is via git command from the shell in your project directory:

git clone https://git.isp-serverfarm.de/freifunk-nordheide/unifi-meshviewer-generator.git .
  • When git is done cloning, execute Composer with the following command:
composer install

Download the Release

If you prefer not to use git, you can simply download the package, uncompress the zip file.

Configuration

  • Copy the .env.example to .env and do not rename the file.
  • Add your specifications to the variables in the .env.
NAMEDescriptionValueRequired
DEBUGEnable Disable the Debug ModeTRUE/FALSEX
TIMEZONESet the TimezoneEurope/BerlinX
OWNER_EMAILSet the Node Owner Email or Phonenumberuser@emaildomain.netX
UNIFI_USERSet the Unifi Controller User NameUnifiStatUserX
UNIFI_PASSSet the Unifi Controller PasswordP@ssw0rd#1234X
UNIFI_URLSet the Unifi Controller URL incl. Porthttps://myuc.domain.de:8443X
UNIFI_ZONESet the Unifi Controller ZonedefaultX
UNIFI_VERSIONSet the Unifi Controller Version5.10.26
FREIFUNK_SSIDFilter the connected wireless clients by this ssidnordheide.freifunk.netX
GATEWAY_NEXTHOPUse the Offloader Node ID18e8295ccf02X
  • Set the WWW root directory of your web server to the Public folder from the project. This prevents direct access to your .env and the folders /cache, /devices and /vendor.
  • Copy the htaccess.txt files to .htaccess in the folders /public and /public/data and set your IP address in the /public/.htaccess file. Do not rename the files. Here you have to set the IP address of the client/server which is allowed to call the index.php regularly e.g. as cronjob. This is a security feature so that the Unifi Controller credentials are not displayed in plain text if an error occurs during execution.
  • Perform a first manual call of index.php (http://myunifiservice.domain.de/index.php). Note: The "public" path should not be included in the call. Otherwise the .env could be reached directly from the internet.
  • With the first call, all AccessPoints are determined and stored in the folder /devices as JSON file. The public name for the AccessPoints must be stored in the files.
  • Create a cronjob that calls index.php every 5 minutes. With this call the information is retrieved via API from the Unifi controller and processed in JSON format.
  • Now share the URL to your webservice with your Community Admin Team. The admins can then integrate the URL into the Meshviewer.

Credits

This class is based on the initial work by the following developers:

and the API as published by Ubiquiti:

Important Disclaimer

Many of the functions in this API client class are not officially supported by UBNT and as such, may not be supported in future versions of the UniFi Controller API.

Contribution

  • TODO