def setColor(): oldColor = light.getColor() data = json.JSONDecoder().decode(request.data) color = data['color'] light.setColor(color) return json.JSONEncoder().encode(oldColor)
def getLight(): return Response( json.dumps({ "light": { "color": light.getColor(), "value": light.getValue() } }), mimetype = 'application/json' )
color.setB(light.ser, 255, 15, 0) color.setW(light.ser, 255) print '<h1><a href="index.py?off">All Lights off</a></h1>' print '<h2>Enter your own RGB color or pick from the list. </h2>' print '<table> <tr>' for set in ['a', 'b', 'w']: # red = 0 # green = 0 # blue = 0 colors = light.getColor(set) if set in ('a', 'b'): red = colors[0] green = colors[1] blue = colors[2] else: white = colors[0] if set == 'a': print '<td><h3>Desk Light</h3>' elif set == 'b': print '<td><h3>Window Light</h3>' elif set == 'w': print '<td><h3>Work Light</h3>'
def getColor(): return Response(json.dumps(light.getColor()), mimetype = 'application/json')
def setValue(value): light.stopAnim() light.setValue(value) light.update() return repr(light.getColor())
def off(): light.stopAnim() light.setValue(0) light.update() return repr(light.getColor())
def showDefaultColor(): light.stopAnim() light.showDefaultColor() light.update() return repr(light.getColor())