Simplify DateTimeType handling for Wolf Smartset

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
Jacob Laursen 2024-12-09 23:10:40 +01:00 committed by lsiepel
parent 9d72871018
commit b186639344

View File

@ -12,7 +12,6 @@
*/
package org.openhab.binding.wolfsmartset.internal.handler;
import java.time.ZonedDateTime;
import java.util.Date;
import javax.measure.Unit;
@ -20,7 +19,6 @@ import javax.measure.quantity.Temperature;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.i18n.TimeZoneProvider;
import org.openhab.core.library.types.DateTimeType;
import org.openhab.core.library.types.DecimalType;
import org.openhab.core.library.types.OnOffType;
@ -83,9 +81,8 @@ public final class WolfSmartsetUtils {
return value == null ? UnDefType.UNDEF : new PointType(value);
}
public static State undefOrDate(@Nullable Date date, TimeZoneProvider timeZoneProvider) {
return date == null ? UnDefType.UNDEF
: new DateTimeType(ZonedDateTime.ofInstant(date.toInstant(), timeZoneProvider.getTimeZone()));
public static State undefOrDate(@Nullable Date date) {
return date == null ? UnDefType.UNDEF : new DateTimeType(date.toInstant());
}
private static boolean isUnknown(Number value) {