def prepare_url(valip, valch, valc, valii):
    """
    Prepare the URL
    """

    ## Parameter - IP
    url = "http://" + valip

    ## Parameter - URL - action
    url += "/api/v100/dali_devices.ssi?action=get_device"

    ## Parameter - Channel
    url += "&ch=" + valch

    ## Parameter - Lamp index, group index or channel
    if valc == 1:
        # Lamp index
        url += "&di=" + valii
    elif valc == 2:
        # Group index
        url += "&gi=" + valii
    else:
        # Channel
        url += "&gi=-1"

    return url