Skip to content

Installation

Paul edited this page Dec 12, 2017 · 14 revisions

System Requirements

The requirements for this project are very low and not at all CPU, Memory or Storage intensive. It can run along side your desktop, in a virtual machine or on a low powered standalone box like a Raspberry Pi Zero.

At it's most basic all it needs is a working Apache installation with PHP installed with the xml and curl extensions

While this project will most likely run with any webserver that works with PHP it has only been tested in environments running Apache

If you don't want to dedicate a whole a box to this project:

  • It is known to work well on the XAMPP Platform. As that is where it was originally developed. It can easily be run on server you may already have running other services.
  • It has also been tested running in a Hyper-V VM

If you wish to run it on a Raspberry Pi we have a walk through for setting up a new system

Installation in Apache on Raspbian

These instructions assume installation on a Raspberry Pi setup as described in our walk through. Other Linux/Debian type operating systems will be similar

Install GIT and Clone the TCPLightingWebInterface Respository

sudo apt install git

Change to your home directory

cd /home/pi

Clone the repository

git clone https://github.com/bren1818/TCPLightingWebInterface.git

You now have a copy of the base website

Change to the public_html of your virtual host if you created one i.e.

cd /var/www/html/lighting.local/public_html

or the default html directory if you didn't

cd /var/www/html/

copy the cloned project to this directory

cp -R /home/pi/TCPLightingWebInterface/* .

Edit the variables inconfig.inc.php as described in the config.inc.php Customization section below

vi config.inc.php

If you plan to use the IFTT Integration also copy the .htaccess file

cp -R /home/pi/TCPLightingWebInterface/.htaccess .

Edit .htaccess as described in the IFTT Integration documentation

vi .htaccess

Create blank config files and make them writeable by the web server

touch tcp.token
chmod 777 tcp.token
touch sched.sched
chmod 777 sched.sched
touch schedule.actioned
chmod 777 schedule.actioned

Installation in Apache on XAMPP Windows

If you installed XAMPP using the defaults it created your document root at C:\xampp\htdocs

Download a copy of the project

Extract the files and place them in your document root. The htdocs folder should look something like

Edit the variables in config.inc.php as described in the config.inc.php Customization section below

If you plan to use the IFTT Integration edit .htaccess as described. Otherwise delete it

config.inc.php Customization

To achieve local control of your lights generally only one variable must be edited

define("LIGTHING_BRIDGE_IP", "192.168.1.TCP");

Edit 192.168.1.TCP to be the address of TCP Connected Bridge

All variables in config.inc.php have notes describing them so we will hit on only the items necessary to achieve local function here.

define("LIGTHING_BRIDGE_IP", "192.168.1.TCP"); // IP address of TCP Bridge/Gateway define("LIGHTING_BRIDGE_PORT", "443"); // 443 for new firmware, 80 for legacy - If you don't know, leave it at 443 define("LOCAL_URL", "http://localhost"); // Address of your webserver running this - this is used in runSchedule to call the API

define("USER_EMAIL", "you@email.com"); // I think this is so you dont have to regenerate tokens if you run this script elsewhere define("USER_PASSWORD", "can-be-anything"); // can be anything define("USE_TOKEN_FILE", 1); // store the token in a file vs hard coding it below otherwise fill in line 51

define("FORCE_FADE_ON", 0); //makes it so when lights are turned off they fade to 0 (Like Philips Bulbs) define("FORCE_FADE_OFF", 0); //makes it so when lights are turned on they fade to their assigned value from 0 (Like Philips Bulbs)

define("SAVE_SCHEDULE", 1); //saves schedule to a binary file on save sched.sched define("LOG_ACTIONS", 1); //saves completed actions to schedule.actioned define("LOG_API_CALLS", 1); //log issued API calls

Syncing the Gateway

Once the files are installed open the URI of your new server in your browser of choice i.e. http://192.168.1.4

You should see an image like the one below.

Clone this wiki locally