Now that that's done, we need to make some changes on the pi itself. Run the following command:
Select 2 nano as your editor. Add this line:
# Members of the admin group may gain root privileges
%admin ALL=(ALL) NOPASSWD:ALL
CTRL-X to save. Now we need to edit our user groups:
Confirm 2 as your editor again. Scroll to where the admin group is listed and change the line to this:
CTRL-X to save. What you have just done is allow www-data to execute sudo commands -- necessary to run the python scripts that drive the UNICORN pHAT.
The next step is to install the packages and dependencies your nightlight is going to need to run. The documentation for the unicorn pHat is here. Pimoroni has made a really great nifty little install tool that makes setting up the unicorn pHat a breeze. https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-unicorn-phat.
curl https://get.pimoroni.com/unicornhat | bash
There are also some additional libraries required for some of the python scripts:
sudo apt-get install python-pip
sudo pip install requests
sudo pip install numpy
sudo pip install webcolors
Move all the files in this repo to /var/www/html. Make sure your permissions are correct and everything in /var/www/html/scripts is executable:
sudo chmod 755 *
And... reboot your pi:
Once your pi has rebooted, point your web browser to its IP on your network or hostname.local and have fun!
Todo: Clean up mobile - having issues closing the bootstrap color changing modal on my phone