diff --git a/bundles/org.openhab.binding.meater/src/main/java/org/openhab/binding/meater/internal/handler/MeaterHandler.java b/bundles/org.openhab.binding.meater/src/main/java/org/openhab/binding/meater/internal/handler/MeaterHandler.java index 251de619e8b..6d22995bbad 100644 --- a/bundles/org.openhab.binding.meater/src/main/java/org/openhab/binding/meater/internal/handler/MeaterHandler.java +++ b/bundles/org.openhab.binding.meater/src/main/java/org/openhab/binding/meater/internal/handler/MeaterHandler.java @@ -15,14 +15,12 @@ package org.openhab.binding.meater.internal.handler; import static org.openhab.binding.meater.internal.MeaterBindingConstants.*; import java.time.Instant; -import java.time.ZonedDateTime; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.meater.internal.MeaterConfiguration; import org.openhab.binding.meater.internal.dto.MeaterProbeDTO.Cook; import org.openhab.binding.meater.internal.dto.MeaterProbeDTO.Device; -import org.openhab.core.i18n.TimeZoneProvider; import org.openhab.core.library.types.DateTimeType; import org.openhab.core.library.types.QuantityType; import org.openhab.core.library.types.StringType; @@ -49,11 +47,9 @@ import org.openhab.core.types.UnDefType; public class MeaterHandler extends BaseThingHandler { private String deviceId = ""; - private TimeZoneProvider timeZoneProvider; - public MeaterHandler(Thing thing, TimeZoneProvider timeZoneProvider) { + public MeaterHandler(Thing thing) { super(thing); - this.timeZoneProvider = timeZoneProvider; } @Override @@ -147,14 +143,13 @@ public class MeaterHandler extends BaseThingHandler { case CHANNEL_LAST_CONNECTION: Instant instant = meaterProbe.getLastConnection(); if (instant != null) { - return new DateTimeType(ZonedDateTime.ofInstant(instant, timeZoneProvider.getTimeZone())); + return new DateTimeType(instant); } break; case CHANNEL_COOK_ESTIMATED_END_TIME: if (cook != null) { if (cook.time.remaining > -1) { - return new DateTimeType( - ZonedDateTime.now(timeZoneProvider.getTimeZone()).plusSeconds(cook.time.remaining)); + return new DateTimeType(Instant.now().plusSeconds(cook.time.remaining)); } } } diff --git a/bundles/org.openhab.binding.meater/src/main/java/org/openhab/binding/meater/internal/handler/MeaterHandlerFactory.java b/bundles/org.openhab.binding.meater/src/main/java/org/openhab/binding/meater/internal/handler/MeaterHandlerFactory.java index c81282b7fbd..e450d6b1ccf 100644 --- a/bundles/org.openhab.binding.meater/src/main/java/org/openhab/binding/meater/internal/handler/MeaterHandlerFactory.java +++ b/bundles/org.openhab.binding.meater/src/main/java/org/openhab/binding/meater/internal/handler/MeaterHandlerFactory.java @@ -20,7 +20,6 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jetty.client.HttpClient; import org.openhab.core.i18n.LocaleProvider; -import org.openhab.core.i18n.TimeZoneProvider; import org.openhab.core.io.net.http.HttpClientFactory; import org.openhab.core.thing.Bridge; import org.openhab.core.thing.Thing; @@ -49,13 +48,11 @@ public class MeaterHandlerFactory extends BaseThingHandlerFactory { private final Gson gson; private final HttpClient httpClient; - private final TimeZoneProvider timeZoneProvider; private final LocaleProvider localeProvider; @Activate - public MeaterHandlerFactory(@Reference TimeZoneProvider timeZoneProvider, @Reference LocaleProvider localeProvider, + public MeaterHandlerFactory(@Reference LocaleProvider localeProvider, @Reference HttpClientFactory httpClientFactory) { - this.timeZoneProvider = timeZoneProvider; this.localeProvider = localeProvider; this.httpClient = httpClientFactory.getCommonHttpClient(); this.gson = new Gson(); @@ -71,7 +68,7 @@ public class MeaterHandlerFactory extends BaseThingHandlerFactory { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (THING_TYPE_MEATER_PROBE.equals(thingTypeUID)) { - return new MeaterHandler(thing, timeZoneProvider); + return new MeaterHandler(thing); } else if (THING_TYPE_BRIDGE.equals(thingTypeUID)) { return new MeaterBridgeHandler((Bridge) thing, httpClient, gson, localeProvider); }