-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[linky] Handle case when data from yesterday is still NaN #9423
Conversation
Fix openhab#9386 Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This PR should fix all problems with channel refresh. When data is retrieved by the binding, if the returned data for yesterday is undefined, the binding considers the data as not valid and will wait for the next refresh time to update the channels. This PR also simplifies the retrieval of the week values, with correct values even the Monday. |
Ok, it works as expected. The problem is that the remote data for yesterday are provided very late in the morning. At 8 in the morning, they were not yet there. At 11, it was ok. I tried just beofre 9am to produce a report with the console command and value from yesyerdau was presented. I don't know if this is the same thing everyday but it looks like the remote data are updated between 8 and 9 in the morning. I will tune a little the current refresh settings but with my current PR we have valid data at 11 in the morning. If you look before 11am, value from yesterday channel is in fact the value from the day before yesterday. I imagine two options:
|
You approved while it is not yet finished ;) |
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Yes, I think you could split. |
Ready for review & merge. |
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
...hab.binding.linky/src/main/java/org/openhab/binding/linky/internal/handler/LinkyHandler.java
Outdated
Show resolved
Hide resolved
...hab.binding.linky/src/main/java/org/openhab/binding/linky/internal/handler/LinkyHandler.java
Outdated
Show resolved
Hide resolved
...hab.binding.linky/src/main/java/org/openhab/binding/linky/internal/handler/LinkyHandler.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
public void log(String title, boolean withDateFin, DateTimeFormatter dateTimeFormatter, boolean onlyLast) { | ||
if (LOGGER.isDebugEnabled()) { | ||
int size = (datas == null || periodes == null) ? 0 | ||
: (datas.size() <= periodes.size() ? datas.size() : periodes.size()); | ||
if (onlyLast) { | ||
if (size > 0) { | ||
log(size - 1, title, withDateFin, dateTimeFormatter); | ||
} | ||
} else { | ||
for (int i = 0; i < size; i++) { | ||
log(i, title, withDateFin, dateTimeFormatter); | ||
} | ||
} | ||
} | ||
} | ||
|
||
private void log(int index, String title, boolean withDateFin, DateTimeFormatter dateTimeFormatter) { | ||
if (withDateFin) { | ||
LOGGER.debug("{} {} {} value {}", title, periodes.get(index).dateDebut.format(dateTimeFormatter), | ||
periodes.get(index).dateFin.format(dateTimeFormatter), datas.get(index)); | ||
} else { | ||
LOGGER.debug("{} {} value {}", title, periodes.get(index).dateDebut.format(dateTimeFormatter), | ||
datas.get(index)); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this logic into LinkyHandler instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will but I don't understand why...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I suggested moving the logic is because you want to minimize the amount of logic you are doing in DTO classes since the null checker doesn't check dto classes.
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Wait a second, I will move |
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Ok, this time, it is really finished and ready for a final review. |
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
* [linky] Handle case when data from yesterday is still NaN Fix openhab#9386 * Refresh every 2 hours until data from yesterday are available * Log yesterday even for month and year requests Signed-off-by: Laurent Garnier <lg.hc@free.fr>
* [linky] Handle case when data from yesterday is still NaN Fix openhab#9386 * Refresh every 2 hours until data from yesterday are available * Log yesterday even for month and year requests Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Fix #9386
Signed-off-by: Laurent Garnier lg.hc@free.fr