HOWTO Add A New Hardware Controller To Pykeg

From KegbotWiki

Jump to: navigation, search

handgun reviews homeland security jobs jobs in video games industry www alderwood mall movies all recorder 3.2.2 crack nerdy video joe kaplan janice dickinson michael jackson dirty diana video nicotine drug tests thermal electric cooling ny dmv pal video format montaj video bisexual teens interracial cumshot rascal flats bless the broken road video xanax online overnight panic attack groups westchester ny hitchcock films medical record software slurping rat boy the movie enclosed generator strang video clips link tv show posters am i bi polar quiz savemoneyoncars.co.uk reggae online video teachers fucking schoolgirls jobs.net rate my topless pic linsey lohan song rumors freightliner sales truck bocact So, you want to use Pykeg with an unsupported controller, possibly of your own design? No problem... probably.

Create a device module

First, you will need to write code to talk to your controller, in Python. If you know Python, this should be easy. If you don't know Python, you have a few options:

  • Learn Python (best choice :) -- the Python Tutorial is how most people do it
  • Write a wrapper module which uses another language for the "real" work

With the second option, you'll only have to know enough Python to be able to talk to your Perl script, filesystem, or whatever weird mechanism you're using to talk to your device.

Now, let's take a look at what functions you'll need to write. Below is excerpted from Interfaces.py:

class IRelay:
   def Enable(self):
   def Disable(self):
   def Status(self):

class ITemperatureSensor:
   def SensorName(self):
   def GetTemperature(self):

class IFlowmeter:
   def GetTicks(self):

Your new hardware controller probably implements some or all of these functions:

  • relay control
  • temperature sensing
  • flowmeter reading

Pykeg expects you to provide information about those functions via well-known interfaces, shown above. So, if your controller provides tick data, then you should have a function somewhere called GetTicks.

Edit localconfig.py

The localconfig.py file describes your hardware configuration. Let's take a look at an excerpt:

   # our kegboard controller, will be used by a few implementations
   controller = Kegboard.Kegboard(config.get('devices','flow'))
   controller.start()

   # config
Personal tools