From 7feafba28589fb839303ba622e496f84dfbfc7e5 Mon Sep 17 00:00:00 2001 From: Jacob Laursen Date: Wed, 27 Nov 2024 23:29:51 +0100 Subject: [PATCH] Simplify DateTimeType handling for Bosch Indego Signed-off-by: Jacob Laursen --- .../internal/handler/BoschIndegoHandler.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/bundles/org.openhab.binding.boschindego/src/main/java/org/openhab/binding/boschindego/internal/handler/BoschIndegoHandler.java b/bundles/org.openhab.binding.boschindego/src/main/java/org/openhab/binding/boschindego/internal/handler/BoschIndegoHandler.java index 47be0253d96..c14b0d89f64 100644 --- a/bundles/org.openhab.binding.boschindego/src/main/java/org/openhab/binding/boschindego/internal/handler/BoschIndegoHandler.java +++ b/bundles/org.openhab.binding.boschindego/src/main/java/org/openhab/binding/boschindego/internal/handler/BoschIndegoHandler.java @@ -18,7 +18,6 @@ import java.nio.charset.StandardCharsets; import java.time.Duration; import java.time.Instant; import java.time.LocalDateTime; -import java.time.ZonedDateTime; import java.time.temporal.ChronoUnit; import java.util.Map; import java.util.Optional; @@ -448,12 +447,7 @@ public class BoschIndegoHandler extends BaseThingHandler implements Authorizatio private void refreshLastCuttingTime() throws IndegoAuthenticationException, IndegoException { if (isLinked(LAST_CUTTING)) { Instant lastCutting = controller.getPredictiveLastCutting(); - if (lastCutting != null) { - updateState(LAST_CUTTING, - new DateTimeType(ZonedDateTime.ofInstant(lastCutting, timeZoneProvider.getTimeZone()))); - } else { - updateState(LAST_CUTTING, UnDefType.UNDEF); - } + updateState(LAST_CUTTING, lastCutting == null ? UnDefType.UNDEF : new DateTimeType(lastCutting)); } } @@ -472,8 +466,7 @@ public class BoschIndegoHandler extends BaseThingHandler implements Authorizatio if (isLinked(NEXT_CUTTING)) { Instant nextCutting = controller.getPredictiveNextCutting(); if (nextCutting != null) { - updateState(NEXT_CUTTING, - new DateTimeType(ZonedDateTime.ofInstant(nextCutting, timeZoneProvider.getTimeZone()))); + updateState(NEXT_CUTTING, new DateTimeType(nextCutting)); scheduleCuttingTimesRefresh(nextCutting); } else { updateState(NEXT_CUTTING, UnDefType.UNDEF);