Fix IndexOutOfBoundsException in aggregator function (#11113)
Signed-off-by: Anders Alfredsson <andersb86@gmail.com>
This commit is contained in:
parent
9fed16d8bb
commit
c084ec3a5b
|
@ -34,6 +34,7 @@ The complete channel identifier is the channel group id (`hour_<offset>` or `day
|
|||
or the number of hours/days from now) + the channel id, concatenated with a `#`.
|
||||
|
||||
Examples:
|
||||
|
||||
* Temperature for the current hour: `hour_0#t`
|
||||
* Total precipitation 3 days from now: `day_3#ptotal`
|
||||
|
||||
|
|
|
@ -64,6 +64,9 @@ public class ForecastAggregator {
|
|||
*/
|
||||
public static Optional<BigDecimal> total(TimeSeries timeSeries, int dayOffset, String parameter) {
|
||||
List<Forecast> dayForecasts = timeSeries.getDay(dayOffset);
|
||||
if (dayForecasts.size() == 1) {
|
||||
return dayForecasts.get(0).getParameter(parameter);
|
||||
}
|
||||
List<BigDecimal> values = new ArrayList<>();
|
||||
for (int i = 0; i < dayForecasts.size(); i++) {
|
||||
Forecast current = dayForecasts.get(i);
|
||||
|
|
|
@ -254,6 +254,7 @@ public class SmhiHandler extends BaseThingHandler {
|
|||
} catch (RuntimeException e) {
|
||||
logger.warn("Unexpected exception occurred, please report to the developers: {}: {}", e.getClass(),
|
||||
e.getMessage());
|
||||
logger.debug("Details: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue