From b74e1e671daa5ea6b31ad2519458ba6bbd8a2a1b Mon Sep 17 00:00:00 2001 From: Jacob Laursen Date: Mon, 25 Nov 2024 22:53:13 +0100 Subject: [PATCH] Simplify DateTimeType handling for FMI Weather Signed-off-by: Jacob Laursen --- .../binding/fmiweather/internal/AbstractWeatherHandler.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/bundles/org.openhab.binding.fmiweather/src/main/java/org/openhab/binding/fmiweather/internal/AbstractWeatherHandler.java b/bundles/org.openhab.binding.fmiweather/src/main/java/org/openhab/binding/fmiweather/internal/AbstractWeatherHandler.java index 4843b9509c6..e6f26c66c31 100644 --- a/bundles/org.openhab.binding.fmiweather/src/main/java/org/openhab/binding/fmiweather/internal/AbstractWeatherHandler.java +++ b/bundles/org.openhab.binding.fmiweather/src/main/java/org/openhab/binding/fmiweather/internal/AbstractWeatherHandler.java @@ -16,8 +16,6 @@ import static org.openhab.binding.fmiweather.internal.BindingConstants.*; import java.math.BigDecimal; import java.time.Instant; -import java.time.ZoneId; -import java.time.ZonedDateTime; import java.util.Objects; import java.util.Optional; import java.util.concurrent.ScheduledFuture; @@ -60,7 +58,6 @@ import org.slf4j.LoggerFactory; @NonNullByDefault public abstract class AbstractWeatherHandler extends BaseThingHandler { - private static final ZoneId UTC = ZoneId.of("UTC"); protected static final String PROP_LONGITUDE = "longitude"; protected static final String PROP_LATITUDE = "latitude"; protected static final String PROP_NAME = "name"; @@ -202,8 +199,7 @@ public abstract class AbstractWeatherHandler extends BaseThingHandler { */ protected > void updateEpochSecondStateIfLinked(ChannelUID channelUID, long epochSecond) { if (isLinked(channelUID)) { - updateState(channelUID, new DateTimeType(ZonedDateTime.ofInstant(Instant.ofEpochSecond(epochSecond), UTC) - .withZoneSameInstant(ZoneId.systemDefault()))); + updateState(channelUID, new DateTimeType(Instant.ofEpochSecond(epochSecond))); } }