Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bundles/org.openhab.binding.ondilo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Each Ondilo ICO will appear as a new Thing in the inbox.

Ondilo ICO takes measures every hour.
Higher polling will not increase the update interval.
The binding automatically adjusts the polling schedule to match the expected time of the next measure, which is typically 1 hour (plus 1.5 minutes buffer) after the previous measure.
The binding automatically adjusts the polling schedule to match the expected time of the next measure, which is typically 1 hour (plus 3 minutes buffer) after the previous measure.

The requests to the Ondilo Customer API are limited to the following per user quotas:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ public synchronized void pollOndiloICOs() {

private void adaptPollingToValueTime(Instant lastValueTime, int refreshInterval) {
// Measures are taken every 60 minutes, so we should be able to
// retrieve next data directly 60 minutes + buffer of 90 seconds after the last measure.
// retrieve next data directly 60 minutes + buffer of 3 minutes after the last measure.
// This can help to avoid polling too frequently and hitting API rate limits.
// If the last measure was taken at 12:00°°, we will poll again at 13:01³°.
// If the last measure was taken at 12:00, we will poll again at 13:03.
// This allows for a buffer in case the measure is not available immediately.
Instant nextValueTime = lastValueTime.plusSeconds(3690); // 60 minutes + 1 minute + 30 seconds buffer
Instant nextValueTime = lastValueTime.plusSeconds(3780); // 60 minutes + 3 minutes
Instant now = Instant.now();
Instant scheduledTime = now.plusSeconds(refreshInterval);
if (nextValueTime.isBefore(scheduledTime)) {
Expand All @@ -148,7 +148,7 @@ private void adaptPollingToValueTime(Instant lastValueTime, int refreshInterval)
if (ondiloBridgePollingJob != null) {
ondiloBridgePollingJob.cancel(true);
}
ondiloBridgePollingJob = scheduler.scheduleWithFixedDelay(() -> pollOndiloICOs(), delay,
this.ondiloBridgePollingJob = scheduler.scheduleWithFixedDelay(() -> pollOndiloICOs(), delay,
refreshInterval, TimeUnit.SECONDS);
logger.trace("Rescheduled polling to {} (delay {} seconds)", nextValueTime, delay);
}
Expand Down