Skip to content

Commit

Permalink
[aWATTar] little cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Leber <thomas@tl-photography.at>
  • Loading branch information
tl-photography committed Aug 4, 2024
1 parent 9ed7ffd commit 4f5d21a
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class AwattarBridgeHandler extends BaseBridgeHandler {
private static final int DATA_REFRESH_INTERVAL = 60;

private final Logger logger = LoggerFactory.getLogger(AwattarBridgeHandler.class);
private final HttpClient httpClient;

private @Nullable ScheduledFuture<?> dataRefresher;
private Instant lastRefresh = Instant.EPOCH;
Expand All @@ -65,13 +66,11 @@ public class AwattarBridgeHandler extends BaseBridgeHandler {
private ZoneId zone;

private @Nullable AwattarApi awattarApi;
private HttpClient httpClient;

public AwattarBridgeHandler(Bridge thing, HttpClient httpClient, TimeZoneProvider timeZoneProvider) {
super(thing);
zone = timeZoneProvider.getTimeZone();

this.httpClient = httpClient;
zone = timeZoneProvider.getTimeZone();
}

@Override
Expand Down Expand Up @@ -127,12 +126,9 @@ private void refresh() {
* The data is refreshed if:
* - the thing is offline
* - the local cache is empty
* - the current time is after 15:00 and the last refresh was more than an hour
* ago
* - the current time is after 18:00 and the last refresh was more than an hour
* ago
* - the current time is after 21:00 and the last refresh was more than an hour
* ago
* - the current time is after 15:00 and the last refresh was more than an hour ago
* - the current time is after 18:00 and the last refresh was more than an hour ago
* - the current time is after 21:00 and the last refresh was more than an hour ago
*
* @return true if the data needs to be refreshed
*/
Expand Down

0 comments on commit 4f5d21a

Please sign in to comment.