def _get_all_forecast_from_api(api_result: dict) -> OrderedDict:
    """Converts results fråm API to SmhiForeCast list"""
    # Total time in hours since last forecast
    total_hours_last_forecast = 1.0

    # Last forecast time
    last_time = None

    # Need the ordered dict to get
    # the days in order in next stage
    forecasts_ordered = OrderedDict()

    # Get the parameters
    for forecast in api_result['timeSeries']:

        valid_time = datetime.strptime(
            forecast['validTime'], "%Y-%m-%dT%H:%M:%SZ")
        for param in forecast['parameters']:
            if param['name'] == 't':
                temperature = float(param['values'][0])  # Celcisus
            elif param['name'] == 'r':
                humidity = int(param['values'][0])  # Percent
            elif param['name'] == 'msl':
                pressure = int(param['values'][0])  # hPa
            elif param['name'] == 'tstm':
                thunder = int(param['values'][0])  # Percent
            elif param['name'] == 'tcc_mean':
                octa = int(param['values'][0])  # Cloudiness in octas
                if 0 <= octa <= 8:  # Between 0 -> 8
                    cloudiness = round(100*octa/8)  # Convert octas to percent
                else:
                    cloudiness = 100  # If not determined use 100%
            elif param['name'] == 'Wsymb2':
                symbol = int(param['values'][0])  # category
            elif param['name'] == 'pcat':
                precipitation = int(param['values'][0])  # percipitation
            elif param['name'] == 'pmean':
                mean_precipitation = float(
                    param['values'][0])  # mean_percipitation
            elif param['name'] == 'ws':
                wind_speed = float(param['values'][0])  # wind speed
            elif param['name'] == 'wd':
                wind_direction = int(param['values'][0])  # wind direction
            elif param['name'] == 'vis':
                horizontal_visibility = float(param['values'][0])  # Visibility
            elif param['name'] == 'gust':
                wind_gust = float(param['values'][0])  # wind gust speed

        roundedTemp = int(round(temperature))

        if last_time is not None:
            total_hours_last_forecast = (valid_time - last_time).seconds/60/60

        # Total precipitation, have to calculate with the nr of
        # hours since last forecast to get correct total value
        tp = round(mean_precipitation*total_hours_last_forecast, 2)

        forecast = \
            SmhiForecast(roundedTemp, roundedTemp, roundedTemp,
                         humidity, pressure, thunder, cloudiness,
                         precipitation, wind_direction, wind_speed,
                         horizontal_visibility, wind_gust,
                         round(mean_precipitation, 1), tp, symbol,
                         valid_time)

        if valid_time.day not in forecasts_ordered:
            # add a new list
            forecasts_ordered[valid_time.day] = []

        forecasts_ordered[valid_time.day].append(forecast)

        last_time = valid_time

    return forecasts_ordered