import configparser


def get_valve_settings(valve_name):
    """ Gets the settings for the valve

    This public function reads the settings for a valve.
    This contains the name, description, status, basictime and watergroup of the valve.
    
    Args:
        str:  valve name

    Returns:
        []:  list of name (str), description (str), status (bool), basictime (int), watergroup (int)
    """


    list = []

    config=configparser.ConfigParser()
    config.read("settings.ini")

    try:
        name = config.get(valve_name, "name")
    except ValueError:
        name = "Ventil xyz"
    list.append(name)

    try:
        description = config.get(valve_name, "description")
    except ValueError:
        description = "Beschreibung xyz"
    list.append(description)

    try:
        status = bool(config.get(valve_name, "isactive"))
    except ValueError:
        status = False
    list.append(status)
    
    try:
        basictime = int(config.get(valve_name, "basictime"))
    except ValueError:
        basictime = 1
    list.append(basictime)
        
    try:
        watergroup = int(config.get(valve_name, "watergroup"))
    except ValueError:
        watergroup = 1
    list.append(watergroup)

    return list