[linky] Filter on dates when building the report requested from console (#17824)

Related to #17070

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
lolodomo 2024-11-30 22:36:10 +01:00 committed by GitHub
parent 0d58d7ec62
commit 15c1d2eaf7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);