diff --git a/bundles/org.openhab.binding.smhi/README.md b/bundles/org.openhab.binding.smhi/README.md index f98fc486a..881843566 100644 --- a/bundles/org.openhab.binding.smhi/README.md +++ b/bundles/org.openhab.binding.smhi/README.md @@ -34,6 +34,7 @@ The complete channel identifier is the channel group id (`hour_` 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` diff --git a/bundles/org.openhab.binding.smhi/src/main/java/org/openhab/binding/smhi/internal/ForecastAggregator.java b/bundles/org.openhab.binding.smhi/src/main/java/org/openhab/binding/smhi/internal/ForecastAggregator.java index 1d1c1079c..d2c4ea55a 100644 --- a/bundles/org.openhab.binding.smhi/src/main/java/org/openhab/binding/smhi/internal/ForecastAggregator.java +++ b/bundles/org.openhab.binding.smhi/src/main/java/org/openhab/binding/smhi/internal/ForecastAggregator.java @@ -64,6 +64,9 @@ public class ForecastAggregator { */ public static Optional total(TimeSeries timeSeries, int dayOffset, String parameter) { List dayForecasts = timeSeries.getDay(dayOffset); + if (dayForecasts.size() == 1) { + return dayForecasts.get(0).getParameter(parameter); + } List values = new ArrayList<>(); for (int i = 0; i < dayForecasts.size(); i++) { Forecast current = dayForecasts.get(i); diff --git a/bundles/org.openhab.binding.smhi/src/main/java/org/openhab/binding/smhi/internal/SmhiHandler.java b/bundles/org.openhab.binding.smhi/src/main/java/org/openhab/binding/smhi/internal/SmhiHandler.java index 89af596ce..c037fe497 100644 --- a/bundles/org.openhab.binding.smhi/src/main/java/org/openhab/binding/smhi/internal/SmhiHandler.java +++ b/bundles/org.openhab.binding.smhi/src/main/java/org/openhab/binding/smhi/internal/SmhiHandler.java @@ -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); } }