def setRGB(self, action, device): try: self.debugLog(u"setRGB: device: " + device.name + ", action:\n" + unicode(action)) red = action.props.get('red', 0) green = action.props.get('green', 0) blue = action.props.get('blue', 0) bulb = WifiLedBulb(device.address) bulb.mode = 'color' bulb.pattern_code = 0x61 if red+green+blue >0: bulb.turnOn() bulb.setRgb(red, green, blue) except Exception: t, v, tb = sys.exc_info() self.handle_exception(t,v,tb)