mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
Simplify DateTimeType handling for OpenUV
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
a989208cc6
commit
541f8d4028
@ -14,8 +14,7 @@ package org.openhab.binding.openuv.internal.handler;
|
||||
|
||||
import static org.openhab.binding.openuv.internal.OpenUVBindingConstants.*;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -100,8 +99,7 @@ public class OpenUVReportHandler extends BaseThingHandler {
|
||||
if ((job == null || job.isCancelled())) {
|
||||
State uvMaxTime = openUVData.getUVMaxTime();
|
||||
if (uvMaxTime instanceof DateTimeType uvMaxDateTime) {
|
||||
long timeDiff = ChronoUnit.MINUTES.between(ZonedDateTime.now(ZoneId.systemDefault()),
|
||||
uvMaxDateTime.getZonedDateTime());
|
||||
long timeDiff = ChronoUnit.MINUTES.between(Instant.now(), uvMaxDateTime.getInstant());
|
||||
if (timeDiff > 0) {
|
||||
logger.debug("Scheduling {} in {} minutes", UV_MAX_EVENT, timeDiff);
|
||||
uvMaxJob = scheduler.schedule(() -> {
|
||||
|
Loading…
Reference in New Issue
Block a user