def __init__(self):
        super(LightServer, self).__init__()

        # interprocess stuff
        self.webserver_pid = None
        self.is_webserver_process = False
        self.web_rx, self.web_tx = os.pipe()
        self.inc_rx, self.inc_tx = os.pipe()

        # set pipes to not block
        fcntl.fcntl(self.web_rx, fcntl.F_SETFL, os.O_NONBLOCK)
        fcntl.fcntl(self.web_tx, fcntl.F_SETFL, os.O_NONBLOCK)
        fcntl.fcntl(self.inc_rx, fcntl.F_SETFL, os.O_NONBLOCK)
        fcntl.fcntl(self.inc_tx, fcntl.F_SETFL, os.O_NONBLOCK)

        self.mode = None
        self.color = None
        self.current_color = None

        self.con = gecoloreffects.Controller()
 def __init__(self):
     super(LightServer, self).__init__()
     self.redis = redis.StrictRedis(host='localhost', port=6379, db=0)
     self.con = gecoloreffects.Controller()
Example #3
0
import gecoloreffects, time

if __name__ == '__main__':
    print 'connecting...'
    con = gecoloreffects.Controller()
    print 'connected'

    print "there are %d lights" % len(con.lights)

    for i in range(0, len(con.lights)):
        con.lights[i] = gecoloreffects.Light().random_color()
        # con.lights[i] = ((i%2)==0) and gecoloreffects.Light.XMAS_COLOR_CYAN() or gecoloreffects.Light.XMAS_COLOR_RED()
        # con.lights[i] = gecoloreffects.Light.XMAS_COLOR_GREEN()
    print 'updating hue'
    con.update_hue()
    print 'done'

    while True:
        pass