Exemplo n.º 1
0
def execute_rule_actions():
    ruleDescription = select_rule()
    if ruleDescription == None:
        print "\n    No rules found"
        return None
    ruleId = ruleDescription['id']
    params = {}
    params['ruleId'] = ruleId

    rule = guh.send_command("Rules.GetRuleDetails", params)['params']['rule']

    if len(rule['exitActions']) == 0:
        options = ["Execute actions"]
        selection = guh.get_selection(
            "Which actions of the rule should be executed?", options)
        response = guh.send_command("Rules.ExecuteActions", params)
        guh.print_rule_error_code(response['params']['ruleError'])
    else:
        options = ["Execute actions", "Execute exit actions"]
        selection = guh.get_selection(
            "Which actions of the rule should be executed?", options)
        if selection == None:
            return None

        if (options[selection] == "Execute actions"):
            response = guh.send_command("Rules.ExecuteActions", params)
            guh.print_rule_error_code(response['params']['ruleError'])
        else:
            response = guh.send_command("Rules.ExecuteExitActions", params)
            guh.print_rule_error_code(response['params']['ruleError'])

    return None
Exemplo n.º 2
0
def read_paramDescriptors(paramTypes):
    params = []
    for paramType in paramTypes:
        selectionTypes = ["yes", "no"]
        selectionText = "-> Do you want to create a descriptor for the param \"%s\"?" % (
            paramType['name'])
        selection = guh.get_selection(selectionText, selectionTypes)
        if selectionTypes[selection] == "no":
            continue
        operator = guh.select_valueOperator(paramType['name'])
        if paramType['type'] == "Bool":
            boolTypes = ["true", "false"]
            selectionString = "Please enter value for parameter \"%s\" (type: %s): " % (
                paramType['name'], paramType['type'])
            selection = guh.get_selection(selectionString, boolTypes)
            if selection == None:
                return None
            paramValue = boolTypes[selection]
        else:
            print "Please enter value for parameter \"%s\" (type: %s): " % (
                paramType['name'], paramType['type'])
            paramValue = raw_input(
                "%s %s " %
                (paramType['name'], guh.get_valueOperator_string(operator)))
        param = {}
        param['paramTypeId'] = paramType['id']
        param['value'] = paramValue
        param['operator'] = operator
        params.append(param)
    #print "got params:", guh.print_json_format(params)
    return params
Exemplo n.º 3
0
def create_time_filter():
    timeFilter = {}
    boolTypes = ["yes","no"]
    selection = guh.get_selection("Do you want to define a \"Start date\"?", boolTypes)
    if boolTypes[selection] == "yes":
        timeFilter['startDate'] = raw_input("Please enter the \"Start date\": ")
    selection = guh.get_selection("Do you want to define a \"End date\"?", boolTypes)
    if boolTypes[selection] == "yes":
        timeFilter['endDate'] = raw_input("Please enter the \"End date\": ")
    return timeFilter
Exemplo n.º 4
0
def read_params(paramTypes):
    params = []
    for paramType in paramTypes:
        print "\nThe ParamType looks like this:\n", guh.print_json_format(
            paramType)
        if any("allowedValues" in item for item in paramType):
            # has to be a string (for sorting list)
            allowedValues = []
            for value in paramType['allowedValues']:
                allowedValues.append(str(value))
            selection = guh.get_selection(
                "Please select one of following allowed values:",
                allowedValues)
            if selection == None:
                return None
            paramValue = paramType['allowedValues'][selection]
            param = {}
            param['paramTypeId'] = paramType['id']
            param['value'] = paramValue
        else:
            # make bool selectable to make shore they are "true" or "false"
            if paramType['type'] == "Bool":
                boolTypes = ["true", "false"]
                selectionString = "Please enter value for parameter \"%s\" (type: %s): " % (
                    paramType['name'], paramType['type'])
                selection = guh.get_selection(selectionString, boolTypes)
                if selection == None:
                    return None
                paramValue = boolTypes[selection]
            elif paramType['type'] == "Int":
                paramValue = int(
                    raw_input(
                        "Please enter value for parameter \"%s\" (type: %s): "
                        % (paramType['name'], paramType['type'])))
            elif paramType['type'] == "Double":
                paramValue = float(
                    raw_input(
                        "Please enter value for parameter \"%s\" (type: %s): "
                        % (paramType['name'], paramType['type'])))
            elif paramType['type'] == "Uint":
                paramValue = int(
                    raw_input(
                        "Please enter value for parameter \"%s\" (type: %s): "
                        % (paramType['name'], paramType['type'])))
            else:
                paramValue = raw_input(
                    "Please enter value for parameter \"%s\" (type: %s): " %
                    (paramType['name'], paramType['type']))
            param = {}
            param['paramTypeId'] = paramType['id']
            param['value'] = paramValue
        params.append(param)
    return params
Exemplo n.º 5
0
def getYesNoSelection(question):
    responseTypes = ["yes","no"]
    selection = guh.get_selection(question, responseTypes)
    if responseTypes[selection] == "yes":
        return True
    else:
        return False
Exemplo n.º 6
0
def discover_device(deviceClassId=None):
    if deviceClassId == None:
        deviceClassId = select_deviceClass()
    deviceClass = get_deviceClass(deviceClassId)
    if not deviceClass:
        return None
    params = {}
    params['deviceClassId'] = deviceClassId
    discoveryParams = parameters.read_params(
        deviceClass['discoveryParamTypes'])
    if len(discoveryParams) > 0:
        params['discoveryParams'] = discoveryParams
    print "\ndiscovering..."
    response = guh.send_command("Devices.GetDiscoveredDevices", params)
    if not 'deviceDescriptors' in response['params']:
        print "no devices found"
    deviceDescriptorList = []
    deviceDescriptorIdList = []
    for deviceDescriptor in response['params']['deviceDescriptors']:
        deviceDescriptorList.append(
            "%s (%s)" %
            (deviceDescriptor['title'], deviceDescriptor['description']))
        deviceDescriptorIdList.append(deviceDescriptor['id'])
    if not deviceDescriptorIdList:
        print "\n    Timeout: no device found."
        return None
    selection = guh.get_selection("Please select a device descriptor",
                                  deviceDescriptorList)
    if selection != None:
        return deviceDescriptorIdList[selection]
    return None
Exemplo n.º 7
0
def createTimeDescriptor():
    print "\n========================================================"
    print "Create time descriptor\n"

    timeDescriptor = {}
    enough = False

    options = ["Create calendar items", "Create time event items"]
    selection = guh.get_selection(
        "Which kind of time items do you want to create?", options)

    if options[selection] == "Create calendar items":
        calendarItems = []
        while not enough:
            calendarItems.append(createCalendarItem())
            input = raw_input(
                "Do you want to add another calendar item? (y/N): ")
            if not input == "y":
                enough = True

        timeDescriptor['calendarItems'] = calendarItems
        return timeDescriptor
    else:
        timeEventItems = []
        while not enough:
            timeEventItems.append(createTimeEventItem())
            input = raw_input(
                "Do you want to add another time event item? (y/N): ")
            if not input == "y":
                enough = True

        timeDescriptor['timeEventItems'] = timeEventItems
        return timeDescriptor
Exemplo n.º 8
0
def edit_params(currentDeviceParams, paramTypes):
    params = []
    for paramType in paramTypes:
        print "\nThe ParamType looks like this:\n", guh.print_json_format(
            paramType)
        if 'readOnly' in paramType:
            if paramType['readOnly'] == True:
                print "--------------------------------------------------------"
                print "\nThe param \"%s\" is not writable! (current = \"%s\")\n" % (
                    paramType['name'],
                    get_param_value(paramType['name'], currentDeviceParams))
                raw_input("\nPress \"enter\" to continue...\n")
                print "--------------------------------------------------------"
                continue
        param = {}
        if any("allowedValues" in item for item in paramType):
            title = "Please select one of following allowed values: (current = \"%s\")" % (
                get_param_value(paramType['name'], currentDeviceParams))
            selection = guh.get_selection(title, paramType['allowedValues'])
            if selection == None:
                return None
            paramValue = paramType['allowedValues'][selection]
            param['paramTypeId'] = paramType['id']
            param['value'] = paramValue
            params.append(param)
        else:
            # make bool selectable to make shore they are "true" or "false"
            if paramType['type'] == "Bool":
                boolTypes = ["true", "false"]
                selectionString = "Please enter value (currently: \"%s\") for parameter \"%s\" (type: %s): " % (
                    get_param_value(paramType['name'], currentDeviceParams),
                    paramType['name'], paramType['type'])
                selection = guh.get_selection(selectionString, boolTypes)
                if selection == None:
                    return None
                paramValue = boolTypes[selection]
                param['paramTypeId'] = paramType['id']
                param['value'] = paramValue
            else:
                paramValue = raw_input(
                    "Please enter value (currently: \"%s\") for parameter \"%s\" (type: %s): "
                    % (get_param_value(paramType['name'], currentDeviceParams),
                       paramType['name'], paramType['type']))
                param['paramTypeId'] = paramType['id']
                param['value'] = paramValue
        params.append(param)
    return params
Exemplo n.º 9
0
def createRepeatingOption(forDateTime=False):
    print "\n========================================================"
    print "Create repeating option\n"
    repeatingOption = {}

    if forDateTime:
        options = ["Repeat yearly"]
        selection = guh.get_selection("Please select the repeating mode:",
                                      options)
        repeatingOption['mode'] = "RepeatingModeYearly"
        print repeatingOption
        return repeatingOption

    options = [
        "0. Repeat hourly", "1. Repeat daily", "2. Repeat weekly",
        "3. Repeat monthly", "4. Repeat yearly"
    ]

    selection = guh.get_selection("Please select the repeating mode:", options)
    if selection is 0:
        repeatingOption['mode'] = "RepeatingModeHourly"

    if selection is 1:
        repeatingOption['mode'] = "RepeatingModeDaily"

    if selection is 2:
        repeatingOption['mode'] = "RepeatingModeWeekly"
        weekDaysString = raw_input(
            "Please enter the list of week days (space separated [1-7]): ")
        repeatingOption['weekDays'] = [
            int(weekDay) for weekDay in weekDaysString.split()
        ]

    if selection is 3:
        repeatingOption['mode'] = "RepeatingModeMonthly"
        monthDaysString = raw_input(
            "Please enter the list of month days (space separated [1-31]): ")
        repeatingOption['monthDays'] = [
            int(monthDay) for monthDay in monthDaysString.split()
        ]

    print repeatingOption
    return repeatingOption
Exemplo n.º 10
0
def set_language():
    params = {}
    languages = get_languages()
    selection = guh.get_selection(
        "Please select one of following allowed values:", languages)
    if selection == None:
        return None

    params['language'] = languages[selection]
    response = guh.send_command("Configuration.SetLanguage", params)
    guh.print_json_format(response['params'])
Exemplo n.º 11
0
def select_createMethod(title, createMethods):
    if len(createMethods) == 0:
        print "ERROR: this device has no createMethods. Please check the plugin code!!!"
        return None
    elif len(createMethods) == 1:
        return createMethods[0]
    else:
        selection = guh.get_selection(title, createMethods)
        if selection == None:
            print "ERROR: could not get selection of CreateMethod"
            return None
        return createMethods[selection]
Exemplo n.º 12
0
def select_eventType(deviceClassId):
    eventTypes = get_eventTypes(deviceClassId)
    if not eventTypes:
        return None
    eventTypeList = []
    for i in range(len(eventTypes)):
        eventTypeList.append(eventTypes[i]['name'])
    selection = guh.get_selection("Please select an event type:",
                                  eventTypeList)
    if selection != None:
        return eventTypes[selection]
    return None
Exemplo n.º 13
0
def set_timezone():
    params = {}
    timeZones = []
    timeZones = get_timezones()
    selection = guh.get_selection(
        "Please select one of following allowed values:", timeZones)
    if selection == None:
        return None

    params['timeZone'] = timeZones[selection]
    response = guh.send_command("Configuration.SetTimeZone", params)
    guh.print_json_format(response['params'])
Exemplo n.º 14
0
def enable_cloud_connection():
    params = {}
    options = ["enable", "disable"]
    selection = guh.get_selection(
        "Do you want to do with the cloud connection: ", options)
    if selection == 0:
        params['enable'] = True
    else:
        params['enable'] = False

    response = guh.send_command("Cloud.Enable", params)
    guh.print_json_format(response['params'])
Exemplo n.º 15
0
def select_actionType(deviceClassId):
    actions = get_actionTypes(deviceClassId)
    if not actions:
        return None
    actionList = []
    #print "got actions", actions
    for i in range(len(actions)):
        #print "got actiontype", actions[i]
        actionList.append(actions[i]['name'])
    selection = guh.get_selection("Please select an action type:", actionList)
    if selection != None:
        return actions[selection]
    return None
Exemplo n.º 16
0
def enable_networking():
    params = {}
    options = ["enable", "disable"]
    selection = guh.get_selection("Do you want to do with the networking: ",
                                  options)
    if selection == 0:
        params['enable'] = True
    else:
        params['enable'] = False

    response = guh.send_command("NetworkManager.EnableNetworking", params)
    guh.print_networkmanager_error_code(
        response['params']['networkManagerError'])
Exemplo n.º 17
0
def select_configured_device():
    devices = get_configured_devices()
    if not devices:
        print "\n    No configured device found.\n"
        return None
    deviceList = []
    deviceIdList = []
    for i in range(len(devices)):
        deviceList.append(devices[i]['name'])
        deviceIdList.append(devices[i]['id'])
    selection = guh.get_selection("Please select a device", deviceList)
    if selection != None:
        return deviceIdList[selection]
    return None
Exemplo n.º 18
0
def select_plugin():
    plugins = get_plugins()
    if not plugins:
        print "\n    No plugins found. Please install guh-plugins and restart guhd."
        return None
    pluginList = []
    pluginIdList = []
    for i in range(0,len(plugins)):
        pluginList.append(plugins[i]['name'])
        pluginIdList.append(plugins[i]['id'])
    selection = guh.get_selection("Please select a plugin", pluginList)
    if selection != None:
        return pluginIdList[selection]
    return None
Exemplo n.º 19
0
def select_vendor():
    vendors = get_supported_vendors()['params']['vendors']
    if not vendors:
        print "\n    No vendors found. Please install guh-plugins and restart guhd."
        return None
    vendorList = []
    vendorIdList = []
    for i in range(0, len(vendors)):
        vendorList.append(vendors[i]['name'])
        vendorIdList.append(vendors[i]['id'])
    selection = guh.get_selection("Please select a vendor", vendorList)
    if selection != None:
        return vendorIdList[selection]
    return None
Exemplo n.º 20
0
def select_stateType(deviceClassId):
    stateTypes = get_stateTypes(deviceClassId)
    if not stateTypes:
        print "\n    This device has no states.\n"
        print "\n========================================================"
        raw_input("-> Press \"enter\" to select an other device!  ")
        return None
    stateTypeList = []
    for i in range(len(stateTypes)):
        stateTypeList.append(stateTypes[i]['name'])
    selection = guh.get_selection("Please select a state type:", stateTypeList)
    if selection != None:
        return stateTypes[selection]
    return None
Exemplo n.º 21
0
def select_configurable_plugin():
    plugins = get_plugins()
    if not plugins:
        print "\n    No plugins found. Please install guh-plugins and restart guhd."
        return None
    pluginList = []
    pluginIdList = []
    for i in range(0,len(plugins)):
        if (len(plugins[i]['paramTypes']) > 0):
            #guh.print_json_format(plugins[i])
            pluginList.append(plugins[i]['name'])
            pluginIdList.append(plugins[i]['id'])
    selection = guh.get_selection("Please select a plugin", pluginList)
    if selection != None:
        return pluginIdList[selection]
    return None
Exemplo n.º 22
0
def select_deviceClass():
    vendorId = select_vendor()
    if not vendorId:
        return None
    deviceClasses = get_deviceClasses(vendorId)
    if not deviceClasses:
        print "\n    No supported devices for this vendor\n"
        return None
    deviceClassList = []
    deviceClassIdList = []
    for i in range(0, len(deviceClasses)):
        deviceClassList.append(deviceClasses[i]['name'])
        deviceClassIdList.append(deviceClasses[i]['id'])
    selection = guh.get_selection("Please select device class",
                                  deviceClassList)
    if selection != None:
        return deviceClassIdList[selection]
    return None
Exemplo n.º 23
0
def select_rule():
    ruleDescriptions = []
    ruleDescriptions = guh.send_command("Rules.GetRules",
                                        {})['params']['ruleDescriptions']
    if not ruleDescriptions:
        print "\n    No rule found"
        return None
    descriptions = []
    for ruleDescription in ruleDescriptions:
        descriptions.append(
            "%s (%s) -> %s / %s" %
            (ruleDescription['name'], ruleDescription['id'],
             print_rule_enabled_status(ruleDescription['enabled']),
             print_rule_active_status(ruleDescription['active'])))
    selection = guh.get_selection("Please select rule:", descriptions)
    if selection != None:
        return ruleDescriptions[selection]
    return None
Exemplo n.º 24
0
def enable_disable_rule():
    ruleDescription = select_rule()
    if ruleDescription == None:
        print "\n    No rules found"
        return
    actionTypes = ["enable", "disable"]
    selection = guh.get_selection("What do you want to do with this rule: ",
                                  actionTypes)
    if selection == 0:
        params = {}
        params['ruleId'] = ruleDescription['id']
        response = guh.send_command("Rules.EnableRule", params)
        guh.print_rule_error_code(response['params']['ruleError'])
    else:
        params = {}
        params['ruleId'] = ruleDescription['id']
        response = guh.send_command("Rules.DisableRule", params)
        guh.print_rule_error_code(response['params']['ruleError'])
Exemplo n.º 25
0
def selectWirelessInterface():
    params = {}
    response = guh.send_command("NetworkManager.GetNetworkDevices", params)
    if response['params'][
            'networkManagerError'] != 'NetworkManagerErrorNoError':
        print("There is no wireless interface available")
        guh.print_networkmanager_error_code(
            response['params']['networkManagerError'])
        return None

    if len(response['params']['wirelessNetworkDevices']) is 1:
        return response['params']['wirelessNetworkDevices'][0]['interface']
    else:
        interfaces = []
        for wirelessNetworkDevice in response['params'][
                'wirelessNetworkDevices']:
            interfaces.append(wirelessNetworkDevice['interface'])

        selection = guh.get_selection("Please select a wifi interface:",
                                      interfaces)
        return interfaces[selection]
Exemplo n.º 26
0
def remove_configured_device():
    deviceId = select_configured_device()
    if not deviceId:
        return None
    print "Removing device with DeviceId%s" % deviceId
    params = {}
    params['deviceId'] = deviceId
    response = guh.send_command("Devices.RemoveConfiguredDevice", params)

    if response['params']['deviceError'] == 'DeviceErrorDeviceInRule':
        selectionString = "This device is used in a rule. How do you want to remove the device from the rules?"
        removePolicys = [
            "Remove the device from the rules", "Delete all offending rules"
        ]
        selection = guh.get_selection(selectionString, removePolicys)

        if removePolicys[selection] == "Remove the device from the rules":
            params['removePolicy'] = "RemovePolicyUpdate"
        else:
            params['removePolicy'] = "RemovePolicyCascade"

        response = guh.send_command("Devices.RemoveConfiguredDevice", params)

    guh.print_device_error_code(response['params']['deviceError'])
Exemplo n.º 27
0
def getBoolSelection(question):
    responseTypes = ["true","false"]
    selection = guh.get_selection(question, responseTypes)
    return responseTypes[selection]
Exemplo n.º 28
0
def configure_tcpServer():
    configurations = guh.send_command("Configuration.GetConfigurations")
    tcpConfigs = configurations['params']['tcpServerConfigurations']
    configList = []
    for i in range(len(tcpConfigs)):
        configList.append("%s:%s   SSL:%s   Auth:%s" %
                          (tcpConfigs[i]['address'], tcpConfigs[i]['port'],
                           tcpConfigs[i]['sslEnabled'],
                           tcpConfigs[i]['authenticationEnabled']))
    configList.append("New entry")
    selection = guh.get_selection("Please select a configuration", configList)
    if selection == None:
        return None

    params = {}
    configuration = {}
    if selection == len(configList) - 1:
        # new config
        configuration['id'] = str(uuid.uuid4())
        configuration['address'] = raw_input(
            "\nEnter the \"address\" of the TCP server: ")
        configuration['port'] = raw_input(
            "\nEnter the \"port\" of the TCP server: ")
        configuration['sslEnabled'] = raw_input(
            "\nEnter whether SSL should be enabled or not: ")
        configuration['authenticationEnabled'] = raw_input(
            "\nEnter whether authentication should be enabled or not: ")
    else:

        selectedConfig = tcpConfigs[selection]

        editList = []
        editList.append("Modify")
        editList.append("Delete")
        editSelection = guh.get_selection(
            "Do you want to edit or delete the server interface?", editList)
        if editSelection == None:
            return None

        if editSelection == 1:  #delete
            params = {}
            params['id'] = selectedConfig['id']
            guh.send_command("Configuration.DeleteTcpServerConfiguration",
                             params)
            return None

        configuration['id'] = selectedConfig['id']
        configuration['address'] = raw_input(
            "\nEnter the \"address\" of the TCP server (current \"%s\"): " %
            (selectedConfig['address']))
        configuration['port'] = raw_input(
            "\nEnter the \"port\" of the TCP server (current %s): " %
            (selectedConfig['port']))
        configuration['sslEnabled'] = raw_input(
            "\nEnter whether SSL should be enabled or not (current \"%s\"): " %
            (selectedConfig['sslEnabled']))
        configuration['authenticationEnabled'] = raw_input(
            "\nEnter whether authentication should be enabled or not (current %s): "
            % (selectedConfig['authenticationEnabled']))
    params['configuration'] = configuration
    response = guh.send_command("Configuration.SetTcpServerConfiguration",
                                params)
    guh.print_json_format(response['params'])
Exemplo n.º 29
0
def create_stateDescriptor():
    print "-> Creating a new stateDescriptor:\n"
    deviceId = devices.select_configured_device()
    device = devices.get_device(deviceId)
    if device == None:
        return None
    stateType = select_stateType(device['deviceClassId'])
    if stateType == None:
        return None
    valueOperator = guh.select_valueOperator(stateType['name'])

    stateDescriptor = {}

    print "\nThe StateType looks like this:\n", guh.print_json_format(
        stateType)
    print "Please enter the value for state \"%s\" (type: %s): " % (
        stateType['name'], stateType['type'])
    # make bool selectable to make shore they are "true" or "false"
    if any("possibleValues" in item for item in stateType):
        # has to be a string (for sorting list)
        possibleValues = []
        for value in stateType['possibleValues']:
            possibleValues.append(str(value))
        selection = guh.get_selection(
            "Please select one of following possible values:", possibleValues)
        if selection == None:
            return None
        stateValue = stateType['possibleValues'][selection]
    else:
        # make bool selectable to make shore they are "true" or "false"
        if stateType['type'] == "Bool":
            boolTypes = ["true", "false"]
            selectionString = "Please enter the value for state \"%s\" (type: %s): " % (
                stateType['name'], stateType['type'])
            selection = guh.get_selection(selectionString, boolTypes)
            if selection == None:
                return None
            stateValue = boolTypes[selection]
        elif stateType['type'] == "Int":
            stateValue = int(
                raw_input("%s %s " %
                          (stateType['name'],
                           guh.get_valueOperator_string(valueOperator))))
        elif stateType['type'] == "Double":
            stateValue = float(
                raw_input("%s %s " %
                          (stateType['name'],
                           guh.get_valueOperator_string(valueOperator))))
        elif stateType['type'] == "Uint":
            stateValue = int(
                raw_input("%s %s " %
                          (stateType['name'],
                           guh.get_valueOperator_string(valueOperator))))
        else:
            stateValue = raw_input(
                "%s %s " % (stateType['name'],
                            guh.get_valueOperator_string(valueOperator)))

    stateDescriptor['deviceId'] = deviceId
    stateDescriptor['stateTypeId'] = stateType['id']
    stateDescriptor['value'] = stateValue
    stateDescriptor['operator'] = valueOperator
    print guh.print_json_format(stateDescriptor)
    return stateDescriptor
Exemplo n.º 30
0
def create_logfilter():
    params = {}
    boolTypes = ["yes","no"]
    
    # Devices
    selection = guh.get_selection("Do you want to filter for \"Devices\"? ", boolTypes)
    if boolTypes[selection] == "yes":
        deviceIds = []
        deviceId = devices.select_configured_device()
        deviceIds.append(deviceId)
        
        
        finished = False
        while not finished:
            selection = guh.get_selection("Do you want to add an other \"Device\"? ", boolTypes)
            if boolTypes[selection] == "no":
                finished = True
                break
            deviceId = devices.select_configured_device()
            if not deviceId:
                params['deviceIds'] = deviceIds
                return params
            deviceIds.append(deviceId)
            
      
        params['deviceIds'] = deviceIds
    
    # LoggingSources
    selection = guh.get_selection("Do you want to filter for \"LoggingSource\"? ", boolTypes)
    if boolTypes[selection] == "yes":
        sources = []
        finished = False
        loggingSources = ["LoggingSourceSystem", "LoggingSourceEvents", "LoggingSourceActions", "LoggingSourceStates", "LoggingSourceRules"]
        selection = guh.get_selection("Please select a \"LoggingSource\": ", loggingSources)
        if selection:
            sources.append(loggingSources[selection])
        else:
            finished = True

        while not finished:
            selection = guh.get_selection("Do you want to add an other \"LoggingSource\"? ", boolTypes)
            if boolTypes[selection] == "no":
                finished = True
                break
            
            selection = get_selection("Please select a \"LoggingSource\": ", loggingSources)
            if selection:
                sources.append(loggingSources[selection])
            else:
                finished = True
                break
        params['loggingSources'] = sources
    
    # LoggingLevel
    selection = guh.get_selection("Do you want to filter for \"LoggingLevel\"? ", boolTypes)
    if boolTypes[selection] == "yes":
        levels = []
        loggingLevels = ["LoggingLevelInfo", "LoggingLevelAlert"]
        selection = guh.get_selection("Please select a \"LoggingLevel\": ", loggingLevels)
        if selection:
            levels.append(loggingLevels[selection])

        params['loggingLevels'] = levels
    
    # LoggingEventType
    selection = guh.get_selection("Do you want to filter for \"LoggingEventType\"? ", boolTypes)
    if boolTypes[selection] == "yes":
        types = []
        loggingEventTypes = ["LoggingEventTypeTrigger", "LoggingEventTypeActiveChange", "LoggingEventTypeEnabledChange", "LoggingEventTypeActionsExecuted", "LoggingEventTypeExitActionsExecuted"]
        selection = guh.get_selection("Please select a \"LoggingEventType\": ", loggingEventTypes)
        if selection:
            types.append(loggingEventTypes[selection])

        params['eventTypes'] = types
    
    # Value
    selection = guh.get_selection("Do you want to filter for certain log \"Values\"? ", boolTypes)
    if boolTypes[selection] == "yes":
        values = []
        finished = False
        value = raw_input("Please enter value which should be filtered out: ")
        values.append(value)
        
        while not finished:
            selection = guh.get_selection("Do you want to add an other \"Value\"? ", boolTypes)
            if boolTypes[selection] == "no":
                finished = True
                break
            value = raw_input("Please enter value which should be filtered out: ")
            values.append(value)
        
        params['values'] = values
    
    # Times
    selection = guh.get_selection("Do you want to add a \"TimeFilter\"? ", boolTypes)
    if boolTypes[selection] == "yes":
        timeFilters = []  
        finished = False
        
        timeFilters.append(create_time_filter())
        while not finished:
            selection = guh.get_selection("Do you want to add an other \"TimeFilter\"? ", boolTypes)
            if boolTypes[selection] == "no":
                finished = True
                break

            timeFilters.append(create_time_filter())
            
        params['timeFilters'] = timeFilters
        
    guh.print_json_format(params)
    guh.debug_stop()
    return params