From a6f9977e29cc47d896fff8d0914cad42c060b07e Mon Sep 17 00:00:00 2001 From: Jacob Laursen Date: Wed, 27 Nov 2024 23:16:47 +0100 Subject: [PATCH] Simplify DateTimeType handling for Tellstick Signed-off-by: Jacob Laursen --- .../internal/handler/TelldusDevicesHandler.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/handler/TelldusDevicesHandler.java b/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/handler/TelldusDevicesHandler.java index 8bfa7c45d74..165cec64829 100644 --- a/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/handler/TelldusDevicesHandler.java +++ b/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/handler/TelldusDevicesHandler.java @@ -15,9 +15,7 @@ package org.openhab.binding.tellstick.internal.handler; import static org.openhab.binding.tellstick.internal.TellstickBindingConstants.*; import java.math.BigDecimal; -import java.time.ZoneId; -import java.time.ZonedDateTime; -import java.util.Calendar; +import java.time.Instant; import org.openhab.binding.tellstick.internal.TellstickBindingConstants; import org.openhab.binding.tellstick.internal.live.xml.DataTypeValue; @@ -292,10 +290,7 @@ public class TelldusDevicesHandler extends BaseThingHandler implements DeviceSta } else { logger.debug("Unhandled Device {}.", device.getDeviceType()); } - Calendar cal = Calendar.getInstance(); - cal.setTimeInMillis(event.getTimestamp()); - updateState(timestampChannel, - new DateTimeType(ZonedDateTime.ofInstant(cal.toInstant(), ZoneId.systemDefault()))); + updateState(timestampChannel, new DateTimeType(Instant.ofEpochMilli(event.getTimestamp()))); } }