/ci-illuminator

An experiment to control LIFX colored bulbs from a CI/CD pipeline.

Primary LanguageGo

CI Illuminator

(Work in progress)

Daemon that receives events via MQTT and controls the color of LIFX smart bulbs to show the status of a CI/CD build pipeline.

Running on Raspberry Pi 3

Install the latest version of Raspbian.

Enable SSH if it is not already

sudo systemctl enable ssh && sudo systemctl start ssh

sudo bash for a root prompt

apt-get install hostapd dnsmasq

Uncomment and edit these lines in /etc/dnsmasq.conf

interface=lo,uap0
no-dhcp-interface=lo,wlan0
dhcp-range=192.168.2.100,192.168.2.200,12h

Edit /etc/hostapd/hostapd.conf and change ssid and wpa_passphrase also (this one is plaintext)

interface=uap0
ssid={your ssid}
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase={your passphrase}
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Edit and add to: /etc/network/interfaces

auto uap0
iface uap0 inet static
address 192.168.2.1
netmask 255.255.255.0

Edit a new file /usr/local/bin/hostapdstart

iw dev wlan0 interface add uap0 type __ap
service dnsmasq restart
sysctl net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -s 192.168.2.0/24 ! -d 192.168.2.0/24 -j MASQUERADE
ifup uap0
hostapd /etc/hostapd/hostapd.conf

Change permissions on /usr/local/bin/hostapdstart

chmod 667 /usr/local/bin/hostapdstart

Edit and add line to /etc/rc.local

hostapdstart >1&

OR just type hostapdstart if you want to see details or if you do not want it to start automatically.

Ignore next step if wlan0 is up and working. Please configure this prior..

Add to /etc/network/interfaces remove all other wlan0 anything references. then add:

auto wlan0
iface wlan0 inet dhcp
wpa-ssid ssidofAP
wpa-psk a03133ea3333471b0d33dbd1b2b19233294649968537c35904eb3389a7df65ba

Replace the psk with yours generated by typing: wpa_passphrase ssidofAP yourWPApass

Your complete /etc/network/interfaces should look like this but with different wpa-psk and wpa-ssid

auto wlan0
iface wlan0 inet dhcp
wpa-ssid ssidofAP
wpa-psk a03133ea3333471b0d33dbd1b2b19233294649968537c35904eb3389a7df65ba

auto uap0
iface uap0 inet static
address 192.168.2.1
netmask 255.255.255.0

Make sure these services are started

sudo service hostapd start
sudo service dnsmasq start