From 15c1d2eaf705e274f3ef8ff3e8b897e2a72e4ad7 Mon Sep 17 00:00:00 2001 From: lolodomo Date: Sat, 30 Nov 2024 22:36:10 +0100 Subject: [PATCH] [linky] Filter on dates when building the report requested from console (#17824) Related to #17070 Signed-off-by: Laurent Garnier --- .../openhab/binding/linky/internal/handler/LinkyHandler.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/handler/LinkyHandler.java b/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/handler/LinkyHandler.java index 09b2b38112d..d38809b29a9 100644 --- a/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/handler/LinkyHandler.java +++ b/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/handler/LinkyHandler.java @@ -326,6 +326,11 @@ public class LinkyHandler extends BaseThingHandler { : (days.datas.size() <= days.periodes.size() ? days.datas.size() : days.periodes.size()); for (int i = 0; i < size; i++) { double consumption = days.datas.get(i); + LocalDate day = days.periodes.get(i).dateDebut.toLocalDate(); + // Filter data in case it contains data from dates outside the requested period + if (day.isBefore(startDay) || day.isAfter(endDay)) { + continue; + } String line = days.periodes.get(i).dateDebut.format(DateTimeFormatter.ISO_LOCAL_DATE) + separator; if (consumption >= 0) { line += String.valueOf(consumption);