Search This Blog

Sunday, October 16, 2016

Installing RaspberryPints on Raspian Jesse

I'v setup a couple Raspberry Pints (RP) on new Raspberry Pi 3 Model B.  While most of the configuration at http://raspberrypints.com/build-flow-meters-2/ is still relevant, there are a couple differences.

I have images below to show the code lines in files that are edited.  This blog tool does not allow me ti easily list code snippets which would make it a lot easier to copy and paste.

Step 5: Package Configuration Wo/Flow Meters

The path to autostart has changed.  From the pi home directory, edit the following file

.config/lxsession/LXDE-pi/autostart

Use the following entry to load Chromium in kiosk mode and instruct Chromium not to display the unsafe shutdown message on restart.


@chromium-browser --incognito --kiosk localhost


Apache2 Default Document Root Directory

Apache2 default document root is /var/www/html.  you can choose to install Raspberry Pints in that directory or change Apache2 configuration.  I chose to change Apache 2 configuration.

Edit /etc/apache2/sites-enabled/000-default.conf and change 

DocumentRoot /var/www/html to DocumentRoot /var/www



My Changes to Raspberry Pints

I make a few changes to Raspberry Pints to suit me needs.  

Add Automatic Refresh 

RP does not refresh the browser on my systems.  Once taps are updated the page needs a manual refresh.  I add a refresh every 60 seconds to automatically pickup tap changes.  There is a refresh.sh tool that I expect should refresh but doesn't work on my system.  Maybe because xdotool isn't installed.

Edit /var/www/index.php

Add the meta refresh tag as show in the as shown below




Removing CR and LF from beer info.  If you use CR and LF, it breaks the program when you tap a new keg and probably elsewhere.  This change strips CR and LF on all database updates.

Edit /var/www/admin/includes/functions.php and add the following to the bottom.






Automatically Mark Kegs as Clean When A Keg is Kicked

I don't manage kegs and don't care about the keg feature.  I just want to show my taps.  The process to kick a keg and tap a new beer is a bit tedious especially at a festival.  So, I automatically mark a keg a clean when I kick it.

Edit /var/www/admin/includes/managers/tap_manager.ph

I prefer to backup the original instruction.  Find and add a # to comment out the following line and add the line afterwards.  It is easiest to copy and paste the first line then add the #.  Change NEEDS_CLEANING to CLEAN


#$sql="UPDATE kegs k, taps t SET k.kegStatusCode = 'NEEDS_CLEANING' WHERE t.kegId = k.id AND t.Id = $id";
$sql="UPDATE kegs k, taps t SET k.kegStatusCode = 'CLEAN' WHERE t.kegId = k.id AND t.Id = $id";



Remove Column Headers

Most people already know what the columns mean.  I can get some more screen real estate by removing the column headers.  the following simply adds comment tags to not display the header.

Edit /var/www/index.php 
Around line 111, locate the thead tag and add the !-- as show below.  Then locate the closing /thead tag and add the --> as show below.




Rearrange Columns to List Beer Name after the Tap Number

This is a bit more complex.  I recommend backing up index.php before making changes.  

cd /var/www
cp index.php index.php.orig



Locate the following text for the Name Column and copy to the clipboard **.  It is around line 174.







Now scroll up and locate. It is around line 160.




 
Paste the Name column data, from copied earlier, above the ConfigName line.  Save. Reload the taps page and verify the changes are ok.

** There are various ways to cut and paste or copy and delete depending in the editor you use.  

If you screw up the tables, just copy index.php.orig to index.php.


I also make changes to style.css and update fonts, sizes, colors, table width (so name column is wider).


Cheers!











No comments: