enricorossi.org

Enrico Rossi


Python opengarden API

Just push out the first implemetation of the Open Garden python API project.

From the pydoc generated man page.

Help on module ogarden:

NAME
    ogarden - Python-OpenGarden module API

FILE
    /home/enrico/python-opengarden/ogarden.py

DESCRIPTION
    This module contains the python API to an opengarden device.

CLASSES
    OpenGarden
    
    class OpenGarden
      The basic class definition
      
      Some usefull docs.
      
      Examples:
      
      myobj = OpenGarden       # define the object
      myobj.connect()          # connect to the device.
      print myobj.id           # print the id.
      og.load()
      print og.sunsite         # print the sunsite attribute.
      for i in og.programs:
          print i
      og.disconnect()
      del(og)
      
      Formats:
      - self.programs = [(1530,30,0xff,1), (1600,45,0x10,2)]
      - self.sunsite is device phisical installation where:
          0 is shadowed site.
          1 half-sun site.
          2 full sun site.
      
      Known Bugs:
      - Serial port must not be hardcoded here.
      - self.id name is too common, change it to something else.
      
      Methods defined here:
      
      connect(self)
          Connect to the device and set the device id.
      
      disconnect(self)
          Close the connection.
      
      load(self)
          loads programs and sunsite attributes from the device.
      
      save(self)
          save programs and sunsite attributes to the device.
      
      temperature(self)
          Read the temperature from the device's thermometer.
          
          Example:
              print og.temperature()
      
      time(self, t=None)
          Get or set the time of the device.
          
          Keyword arguments:
              t -- time_t value of the updated timer.
          
          Example:
              print og.time()     # print the time (format time_t)
              og.time(1319724362) # set the time to 2011-10-27 04:06:02 PM
      
      ----------------------------------------------------------------------
      Data and other attributes defined here:
      
      id = None
      
      programs = None
      
      sunsite = None

DATA
    __author__ = 'Enrico Rossi <e.rossi@tecnobrain.com>'
    __credits__ = 'Nicola Galliani, the "On the field" beta tester....esig...
    __date__ = '27 October 2011'
    __version__ = '$Revision: 0.1b $'

VERSION
    0.1b

DATE
    27 October 2011

AUTHOR
    Enrico Rossi <e.rossi@tecnobrain.com>

CREDITS
    Nicola Galliani, the "On the field" beta tester.
    Andrea Marabini, the electronic designer.
    Alessandro Dotti Contra, GUI developer.