Skip to content

Commit

Permalink
Gapfiller - some more debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
zeekoe committed Jan 29, 2024
1 parent 11e8355 commit 93a8315
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/main/java/com/github/zeekoe/bluebird/heatpump/Gapfiller.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ public class Gapfiller {

public Gapfiller() {
this.gapStartTime = ZonedDateTime.now().minusHours(2);
System.out.println("Gapfiller fresh start, set gap start time to " + gapStartTime);
System.out.println("Gapfiller fresh start.");
nextFillTime = ZonedDateTime.now().plusSeconds(10);
printGapfillerWindow();
setTimeWindow();

}
Expand All @@ -48,14 +49,18 @@ public void checkAndRun() {
gapStartTime = nextFillTime;
nextFillTime = ZonedDateTime.now()
.plusMinutes(timeWindow)
.plusSeconds(new Random().nextInt(20));
System.out.println("Gapfiller next window: " + gapStartTime + " - " + nextFillTime);
.plusSeconds(new Random().nextInt(20)); // wait a little after the initial startup server load
printGapfillerWindow();
}
} catch (Exception e) {
System.out.println("Gapfiller failed: " + e.getMessage());
}
}

private void printGapfillerWindow() {
System.out.println("Gapfiller next window: " + gapStartTime + " - " + nextFillTime);
}

private void fillTheGaps(HeatpumpLog[] heatpumplogs) {
if (heatpumplogs.length < 2) {
System.out.println("Please call this method for a bigger period");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public HeatpumpLog[] doHeatpumpGapRequest(ZonedDateTime gapStartTime) throws IOE
final String to = formatDateTime(now);

String url = property(WEHEAT_LOG_URL).replace("/latest", "") + "/raw?startTime=" + from + "&endTime=" + to;
System.out.println(url);
return OBJECT_MAPPER.readValue(httpClient.get(url, auth.getToken()), HeatpumpLog[].class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public List<ZonedDateTime> retrieveInfluxedTimesBetween(ZonedDateTime oldestLog,
final String queryString = "SELECT \"t_room\" FROM \"" + property(INFLUXDB_MEASUREMENT) + "\" " +
" WHERE time >= '" + oldestLog.format(DateTimeFormatter.ISO_ZONED_DATE_TIME) + "'" +
" and time <= '" + newestLog.format(DateTimeFormatter.ISO_ZONED_DATE_TIME) + "';";
System.out.println(queryString);
final QueryResult result = influxDB.query(new Query(queryString));
final List<QueryResult.Series> series1 = result.getResults().get(0).getSeries();

Expand Down

0 comments on commit 93a8315

Please sign in to comment.