Skip to content

henroFall/TCPLightingWebInterface-MQTT-DOCKER

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HeaderWebInterface

TCPLightingWebInterface-MQTT - Can be used with MQTT & IFTTT

This is a fork of awesome TCPLightingWebInterface-MQTT (https://github.com/sktaylortrash/TCPLightingWebInterface-MQTT), which is "a fork of the fabulous TCPLightingWebInterface" (https://github.com/bren1818/TCPLightingWebInterface) created by bren1818.

That fork aimed to remove cloud dependance by leveraging MQTT. While leaving the IFTTT focused API available. This is acheived through an additional python script (generated as needed by a PHP script), a couple cron jobs and a small API change

Setup for that complete effort is as described in the project's wiki - https://github.com/sktaylortrash/TCPLightingWebInterface-MQTT/wiki

This particular fork is a move to containerize the solution that recucisitates the TCP Lighting Gateway. You need to downgrade the gateway to v2 and block its internet access to make this easier.... (https://github.com/bren1818/TCPFirmwareRestore)

To install

Go to the command line of your Linux machine with docker-compose on it.

cd ~
mkdir docker
cd docker
mkdir tcplights
cd tcplights
wget -N https://raw.githubusercontent.com/henroFall/TCPLightingWebInterface-MQTT-DOCKER/master/docker-compose.yml

You now have the docker-compose file.

nano docker-compose.yml

That will bring you into the compose file where you need to edit all the variables that apply. You very particularly must set IP_TCPLIGHTS to the IP address of your Gateway. IP_MQTT must also be set for your external MQTT server. Everything else is pretty much optional, based on how you use this thing. You might need to set timezone, GPS, etc. There are lots of comments in the yml file.

You're done. As you can see in the yml, the web insterface is exposed on port 4321.

So, http://yourserverIP:4321 gets you there. You can change that port to anything you want in the yml file. Make it 80 if you don't want to type in a port number.

Here is the docker compose file -

version: '3'
services:
# If you already have an MQTT Server on your LAN, comment out the 
# next 8 lines and the volumes at the bottom of the file. 
  mosquitto:
    image: eclipse-mosquitto
    restart: always
    ports:
      - 1883:1883
    volumes:
      - mosquitto-conf:/mosquitto/config
      - mosquitto-data:/mosquitto/data
            
  tcplights:
    image: henr02/tcplightingwebinterface-mqtt
    ports:
      - "4321:80"
    environment:
      - IP_TCPLIGHTS=192.168.200.166             # IP of the TCP Lighting Gateway
      - IP_MQTT=192.168.200.202                  # IP of the MQTT Server, you can use 
      - PORT_TCPLIGHTS=80                        # Port of the TCP Lighting Gateway (80 is standard for v2 firmware, 443 for v3)
      - PORT_MQTT=1883                           # Port of the MQTT Server (1883 is standard)
      - TCP_TIMEZONE=America/Chicago             # Enter your timezone code to use scheduling in the web app
      - TCP_LATITUDE=32.941900                   # Enter your latitude to use the Sunup/Sundown feature
      - TCP_LONGITUDE=-96.694780                 # Enter your longitude to use the Sunup/Sundown feature
      - FORCE_FADE_ON=0                          # 0/1 Fade to on, as a HUE bulb does
      - FORCE_FADE_OFF=0                         # 0/1 Fade to off, as a HUE bulb does
      - MQTT_USERNAME=admin                      # Username for your MQTT server
      - MQTT_PASSWORD=password                   # Password for your MQTT server
      - APACHE_RUN_USER=www-data                 # You probably shouldn't change this. If you do, you know why.
      - APACHE_RUN_GROUP=www-data                # You probably shouldn't change this. If you do, you know why.
      - APACHE_LOG_DIR=/var/log/apache2          # You probably shouldn't change this. If you do, you know why.
      - APACHE_LOCK_DIR=/var/lock/apache2        # You probably shouldn't change this. If you do, you know why.
      - APACHE_PID_FILE=/var/run/apache2.pid     # You probably shouldn't change this. If you do, you know why.
      - LOCAL_URL=http://localhost               # You probably shouldn't change this. If you do, you know why.
      - USER_EMAIL=ME@TCPLIGHTS.SUCK             # You probably shouldn't change this. If you do, you know why.
      - USER_PASSWORD=ANYTHING                   # You probably shouldn't change this. If you do, you know why.
      - MQTTsub_id=tcp-subscriber                # You probably shouldn't change this. If you do, you know why. Unique for connecting to server.
      - MQTTpub_id=tcp-publisher                 # You probably shouldn't change this. If you do, you know why. Unique for connecting to server.
      - MQTT_prefix=light                        # You probably shouldn't change this. If you do, you know why.
                                                 # Topic prefix for lights - ie light/<room-name>/<light-name>/<UniqueBulbID>
      - MQTT_control=tcp                         # You probably shouldn't change this. If you do, you know why. 
                                                 # Control topic identifier for host and script control ie control/<MQTT_control>
      - HASSTopic_id=homeassistant               # You probably shouldn't change this. If you do, you know why.
                                                 # Topic prefix for Home Assistant Discovery Topics - this must match with HASS
      - HASSOnline=hass/status                   # You probably shouldn't change this. If you do, you know why.
                                                 # Topic Home Assistant publishes to, to announce its online
volumes:
  mosquitto-conf:
  mosquitto-data:

About

Web App interface with MQTT: to control the "Connected by TCP" bulbs

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 91.6%
  • CSS 2.7%
  • JavaScript 2.2%
  • Shell 1.7%
  • Python 1.3%
  • Dockerfile 0.5%