Kegbot Software

From KegbotWiki

Jump to: navigation, search

Contents

Software Overview

The Kegbot project provides controller and frontend software to run a kegbot free of charge. This is the same code that has powered the original kegbot since 2003, though it has come a long way since. This software is open source, and improvements and patches are greatly appreciated!

This section contains more detailed descriptions of the components that make up a kegbot system.

pykeg core

The pykeg core software is the main "brains" of a kegbot system. Roughly, this software has the following responsibilities:

  • Interface with all beer hardware: flowmeters, valves, freezer-conversion setups
  • Respond to beer flowing: assign to user, record, notify UIs
  • Generate records for events of interest: individual drink pours, temperature logs
  • Provide event information through a publisher service
  • Allow inspection of current status and other functions through an XML-RPC API

The pykeg core today also includes support for an LCD user interface, although that feature is moving to an external process (decoupling it from the core controlling software.)

Pykeg is the dominant client of the database. The ultimate goal of pykeg is to create drink records for each pour. But to do this, pykeg needs to look up who the user is (based on authentication source), determine the access permissions and cost, estimate an instantaneous blood alcohol level based on weight, and so on.

web frontend

The original kegbot web frontend was written in PHP and has long served as the kegbot.org homepage for Mike's kegbot. This is currently undergoing rewrite in Django (and getting a lot more bells and whistles), but the basic idea is the same.

  • Reads directly from the database backend to display statistics
  • Shows drink, keg, and drinker information in excruciating detail
  • Groups drinkers (by binge) pictorally

Event Publisher

Pykeg's event publisher is a lightweight, easy-to-use interface for read-only clients interested in the kegbot status. The event publisher currently streams the following events:

  • Start of a pour
  • Periodic pour update
  • End of a pour
  • Periodic temperature status (if present)

API Server

Pykeg runs an "API Server" that allows other applications to talk directly to the controller software. Services provided by this:

  • Per-channel status (pouring or not, keg id, volume in current flow, drinker of current flow)
  • System control (kill kegbot, lock system, ...)
  • Authentication (optional): allows remote services to authenticate and de-authenticate users for access

Note: This is due for rewrite as of 1/21/07; the existing KegRemoteFunctions service is outdated and does not do the above correctly.

Getting Started

Install third-party software

You will need the following software before you can use the kegbot software.

All of the above should be available (a) free of charge, and (b) for Linux, Mac OS X, and even Windows! The author has only tested kegbot on Linux, and limited use on Mac OS X.

Prepare a place for kegbot software to live

Now, you will need to prepare a place for the kegbot software on your controller computer. It is recommended that you create a new user to run the kegbot software, although there is no requirement to do so.

mkdir kegbot/
cd kegbot/

Install kegbot software

The kegbot software, as well as a few supporting libraries, live in a Subversion repository. You will need a subversion client to check out the software.

svn checkout http://kegbot.googlecode.com/svn/trunk/ kegbot

This will fetch the latest sources for the controller (pykeg), and two supporting libraries for optional hardware.

Create MySQL database for kegbot

Before we can run kegbot, you need to create a table in MySQL for kegbot to fill. You may need to be root to do this.

mysqladmin -u root create kegbot

If you get permission denied errors, it is possible your MySQL configuration requires a password or has some other restrictions, which you will need to figure out.

Create a MySQL user for kegbot (optional)

You probably want to create a new MySQL user for kegbot.

Run configuration script

You're now ready to run the pykeg configuration script, which contains more automated steps and instructions.

cd pykeg/
python scripts/configure.py

Hardware configuration

The stock pykeg software comes with a file, called localconfig.py, which can be thought of as a hardware configuration file. By default, it assumes you have a Kegboard 1 board and are using both freezer control and flow valve control. You will need to edit this file (see comments in it) to taste if this is not your hardware configuration.

Try it out

Did you do everything right? Who knows! Give it a shot:

python kegbot.py

Troubleshooting

This section to be populated as people report common problems :)

Personal tools