From e3101613270f7c395fee66b9ca3b2fb61e66db51 Mon Sep 17 00:00:00 2001 From: Jacob Laursen Date: Tue, 10 Dec 2024 21:03:33 +0100 Subject: [PATCH 01/85] Simplify DateTimeType handling for aha Waste Collection Signed-off-by: Jacob Laursen --- .../internal/AhaWasteCollectionHandler.java | 10 ++-------- .../internal/AhaWasteCollectionHandlerFactory.java | 9 ++------- .../internal/AhaWasteCollectionHandlerTest.java | 7 ++----- 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/bundles/org.openhab.binding.ahawastecollection/src/main/java/org/openhab/binding/ahawastecollection/internal/AhaWasteCollectionHandler.java b/bundles/org.openhab.binding.ahawastecollection/src/main/java/org/openhab/binding/ahawastecollection/internal/AhaWasteCollectionHandler.java index f4b46208cb834..d40aab4c8544b 100644 --- a/bundles/org.openhab.binding.ahawastecollection/src/main/java/org/openhab/binding/ahawastecollection/internal/AhaWasteCollectionHandler.java +++ b/bundles/org.openhab.binding.ahawastecollection/src/main/java/org/openhab/binding/ahawastecollection/internal/AhaWasteCollectionHandler.java @@ -14,7 +14,6 @@ import java.io.IOException; import java.time.Duration; -import java.time.ZonedDateTime; import java.util.Collections; import java.util.Date; import java.util.Map; @@ -26,7 +25,6 @@ import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.ahawastecollection.internal.CollectionDate.WasteType; import org.openhab.core.cache.ExpiringCache; -import org.openhab.core.i18n.TimeZoneProvider; import org.openhab.core.library.types.DateTimeType; import org.openhab.core.scheduler.CronScheduler; import org.openhab.core.scheduler.ScheduledCompletableFuture; @@ -57,7 +55,6 @@ public class AhaWasteCollectionHandler extends BaseThingHandler { private final Lock monitor = new ReentrantLock(); private final ExpiringCache> cache; - private final TimeZoneProvider timeZoneProvider; private final Logger logger = LoggerFactory.getLogger(AhaWasteCollectionHandler.class); private @Nullable AhaCollectionSchedule collectionSchedule; @@ -69,11 +66,10 @@ public class AhaWasteCollectionHandler extends BaseThingHandler { private final ScheduledExecutorService executorService; public AhaWasteCollectionHandler(final Thing thing, final CronScheduler scheduler, - final TimeZoneProvider timeZoneProvider, final AhaCollectionScheduleFactory scheduleFactory, + final AhaCollectionScheduleFactory scheduleFactory, @Nullable final ScheduledExecutorService executorService) { super(thing); this.cronScheduler = scheduler; - this.timeZoneProvider = timeZoneProvider; this.scheduleFactory = scheduleFactory; this.cache = new ExpiringCache<>(Duration.ofMinutes(5), this::loadCollectionDates); this.executorService = executorService == null ? this.scheduler : executorService; @@ -190,9 +186,7 @@ private void updateChannels(final Map collectionDates final Date nextCollectionDate = collectionDate.getDates().get(0); - final ZonedDateTime zonedDateTime = ZonedDateTime.ofInstant(nextCollectionDate.toInstant(), - this.timeZoneProvider.getTimeZone()); - this.updateState(channel.getUID(), new DateTimeType(zonedDateTime)); + this.updateState(channel.getUID(), new DateTimeType(nextCollectionDate.toInstant())); } } diff --git a/bundles/org.openhab.binding.ahawastecollection/src/main/java/org/openhab/binding/ahawastecollection/internal/AhaWasteCollectionHandlerFactory.java b/bundles/org.openhab.binding.ahawastecollection/src/main/java/org/openhab/binding/ahawastecollection/internal/AhaWasteCollectionHandlerFactory.java index 5ad4febf969cd..62fb52a0d8cdf 100644 --- a/bundles/org.openhab.binding.ahawastecollection/src/main/java/org/openhab/binding/ahawastecollection/internal/AhaWasteCollectionHandlerFactory.java +++ b/bundles/org.openhab.binding.ahawastecollection/src/main/java/org/openhab/binding/ahawastecollection/internal/AhaWasteCollectionHandlerFactory.java @@ -18,7 +18,6 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.i18n.TimeZoneProvider; import org.openhab.core.scheduler.CronScheduler; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingTypeUID; @@ -40,7 +39,6 @@ public class AhaWasteCollectionHandlerFactory extends BaseThingHandlerFactory { private static final Set SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_SCHEDULE); private final CronScheduler scheduler; - private final TimeZoneProvider timeZoneProvider; @Override public boolean supportsThingType(final ThingTypeUID thingTypeUID) { @@ -48,10 +46,8 @@ public boolean supportsThingType(final ThingTypeUID thingTypeUID) { } @Activate - public AhaWasteCollectionHandlerFactory(final @Reference CronScheduler scheduler, - final @Reference TimeZoneProvider timeZoneProvider) { + public AhaWasteCollectionHandlerFactory(final @Reference CronScheduler scheduler) { this.scheduler = scheduler; - this.timeZoneProvider = timeZoneProvider; } @Override @@ -59,8 +55,7 @@ public AhaWasteCollectionHandlerFactory(final @Reference CronScheduler scheduler final ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (THING_TYPE_SCHEDULE.equals(thingTypeUID)) { - return new AhaWasteCollectionHandler(thing, this.scheduler, this.timeZoneProvider, - AhaCollectionScheduleImpl::new, null); + return new AhaWasteCollectionHandler(thing, this.scheduler, AhaCollectionScheduleImpl::new, null); } return null; } diff --git a/bundles/org.openhab.binding.ahawastecollection/src/test/java/org/openhab/binding/ahawastecollection/internal/AhaWasteCollectionHandlerTest.java b/bundles/org.openhab.binding.ahawastecollection/src/test/java/org/openhab/binding/ahawastecollection/internal/AhaWasteCollectionHandlerTest.java index 2ae23d2b4090a..f23069cdde547 100644 --- a/bundles/org.openhab.binding.ahawastecollection/src/test/java/org/openhab/binding/ahawastecollection/internal/AhaWasteCollectionHandlerTest.java +++ b/bundles/org.openhab.binding.ahawastecollection/src/test/java/org/openhab/binding/ahawastecollection/internal/AhaWasteCollectionHandlerTest.java @@ -15,8 +15,6 @@ import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; -import java.time.ZoneId; -import java.time.ZonedDateTime; import java.util.Arrays; import java.util.Date; import java.util.Map; @@ -136,15 +134,14 @@ private static AhaWasteCollectionHandler createAndInitHandler(final ThingHandler }).when(executorStub).execute(any(Runnable.class)); final AhaWasteCollectionHandler handler = new AhaWasteCollectionHandler(thing, createStubScheduler(), - ZoneId::systemDefault, new AhaCollectionScheduleStubFactory(), executorStub); + new AhaCollectionScheduleStubFactory(), executorStub); handler.setCallback(callback); handler.initialize(); return handler; } private static State getDateTime(final Date day) { - final ZonedDateTime zonedDateTime = ZonedDateTime.ofInstant(day.toInstant(), ZoneId.systemDefault()); - return new DateTimeType(zonedDateTime); + return new DateTimeType(day.toInstant()); } @Test From e3a1abd191c36edd026e984e33d5d9b84e575719 Mon Sep 17 00:00:00 2001 From: Jacob Laursen Date: Tue, 10 Dec 2024 21:09:35 +0100 Subject: [PATCH 02/85] Simplify DateTimeType handling for Air Quality Signed-off-by: Jacob Laursen --- .../airquality/internal/AirQualityHandlerFactory.java | 9 ++------- .../internal/handler/AirQualityStationHandler.java | 9 ++------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/AirQualityHandlerFactory.java b/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/AirQualityHandlerFactory.java index b6417fff7788c..63af4d867aff6 100644 --- a/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/AirQualityHandlerFactory.java +++ b/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/AirQualityHandlerFactory.java @@ -21,7 +21,6 @@ import org.openhab.binding.airquality.internal.handler.AirQualityBridgeHandler; import org.openhab.binding.airquality.internal.handler.AirQualityStationHandler; import org.openhab.core.i18n.LocationProvider; -import org.openhab.core.i18n.TimeZoneProvider; import org.openhab.core.thing.Bridge; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingTypeUID; @@ -43,13 +42,10 @@ public class AirQualityHandlerFactory extends BaseThingHandlerFactory { private static final Set SUPPORTED_THING_TYPES = Set.of(BRIDGE_TYPE_API, THING_TYPE_STATION); - private final TimeZoneProvider timeZoneProvider; private final LocationProvider locationProvider; @Activate - public AirQualityHandlerFactory(final @Reference TimeZoneProvider timeZoneProvider, - final @Reference LocationProvider locationProvider) { - this.timeZoneProvider = timeZoneProvider; + public AirQualityHandlerFactory(final @Reference LocationProvider locationProvider) { this.locationProvider = locationProvider; } @@ -62,8 +58,7 @@ public boolean supportsThingType(ThingTypeUID thingTypeUID) { protected @Nullable ThingHandler createHandler(Thing thing) { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); - return THING_TYPE_STATION.equals(thingTypeUID) - ? new AirQualityStationHandler(thing, timeZoneProvider, locationProvider) + return THING_TYPE_STATION.equals(thingTypeUID) ? new AirQualityStationHandler(thing, locationProvider) : BRIDGE_TYPE_API.equals(thingTypeUID) ? new AirQualityBridgeHandler((Bridge) thing) : null; } } diff --git a/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/handler/AirQualityStationHandler.java b/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/handler/AirQualityStationHandler.java index f5fede8b12e17..e7afd9812a672 100644 --- a/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/handler/AirQualityStationHandler.java +++ b/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/handler/AirQualityStationHandler.java @@ -40,7 +40,6 @@ import org.openhab.binding.airquality.internal.config.SensitiveGroupConfiguration; import org.openhab.core.config.core.Configuration; import org.openhab.core.i18n.LocationProvider; -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; @@ -78,14 +77,12 @@ public class AirQualityStationHandler extends BaseThingHandler { private final @NonNullByDefault({}) ClassLoader classLoader = AirQualityStationHandler.class.getClassLoader(); private final Logger logger = LoggerFactory.getLogger(AirQualityStationHandler.class); - private final TimeZoneProvider timeZoneProvider; private final LocationProvider locationProvider; private @Nullable ScheduledFuture refreshJob; - public AirQualityStationHandler(Thing thing, TimeZoneProvider timeZoneProvider, LocationProvider locationProvider) { + public AirQualityStationHandler(Thing thing, LocationProvider locationProvider) { super(thing); - this.timeZoneProvider = timeZoneProvider; this.locationProvider = locationProvider; } @@ -263,9 +260,7 @@ private State getValue(String channelId, @Nullable String groupId, AirQualityDat return hum != -1 ? new QuantityType<>(hum, Units.PERCENT) : UnDefType.NULL; case TIMESTAMP: AirQualityTime time = data.getTime(); - return time != null - ? new DateTimeType(time.getObservationTime().withZoneSameLocal(timeZoneProvider.getTimeZone())) - : UnDefType.NULL; + return time != null ? new DateTimeType(time.getObservationTime()) : UnDefType.NULL; case DOMINENT: return new StringType(data.getDominentPol()); case DEW_POINT: From 0ee5fd952e77fca1a4f97411086423d41ae868b7 Mon Sep 17 00:00:00 2001 From: Jacob Laursen Date: Sat, 9 Nov 2024 19:50:21 +0100 Subject: [PATCH 03/85] Simplify DateTimeType handling for Automower Signed-off-by: Jacob Laursen --- .../internal/AutomowerHandlerFactory.java | 9 +++---- .../internal/things/AutomowerHandler.java | 26 +++---------------- 2 files changed, 7 insertions(+), 28 deletions(-) diff --git a/bundles/org.openhab.binding.automower/src/main/java/org/openhab/binding/automower/internal/AutomowerHandlerFactory.java b/bundles/org.openhab.binding.automower/src/main/java/org/openhab/binding/automower/internal/AutomowerHandlerFactory.java index 6f5b5108ddcac..70187832151ff 100644 --- a/bundles/org.openhab.binding.automower/src/main/java/org/openhab/binding/automower/internal/AutomowerHandlerFactory.java +++ b/bundles/org.openhab.binding.automower/src/main/java/org/openhab/binding/automower/internal/AutomowerHandlerFactory.java @@ -27,7 +27,6 @@ import org.openhab.binding.automower.internal.things.AutomowerHandler; import org.openhab.core.auth.client.oauth2.OAuthFactory; import org.openhab.core.config.discovery.DiscoveryService; -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; @@ -56,14 +55,12 @@ public class AutomowerHandlerFactory extends BaseThingHandlerFactory { private final OAuthFactory oAuthFactory; protected final @NonNullByDefault({}) HttpClient httpClient; private @Nullable ServiceRegistration automowerDiscoveryServiceRegistration; - private final TimeZoneProvider timeZoneProvider; @Activate - public AutomowerHandlerFactory(@Reference OAuthFactory oAuthFactory, @Reference HttpClientFactory httpClientFactory, - @Reference TimeZoneProvider timeZoneProvider) { + public AutomowerHandlerFactory(@Reference OAuthFactory oAuthFactory, + @Reference HttpClientFactory httpClientFactory) { this.oAuthFactory = oAuthFactory; this.httpClient = httpClientFactory.getCommonHttpClient(); - this.timeZoneProvider = timeZoneProvider; } @Override @@ -80,7 +77,7 @@ public boolean supportsThingType(ThingTypeUID thingTypeUID) { } if (AutomowerHandler.SUPPORTED_THING_TYPES.contains(thing.getThingTypeUID())) { - return new AutomowerHandler(thing, timeZoneProvider); + return new AutomowerHandler(thing); } return null; diff --git a/bundles/org.openhab.binding.automower/src/main/java/org/openhab/binding/automower/internal/things/AutomowerHandler.java b/bundles/org.openhab.binding.automower/src/main/java/org/openhab/binding/automower/internal/things/AutomowerHandler.java index b0a87a253cd4b..1a8b9ef1faca1 100644 --- a/bundles/org.openhab.binding.automower/src/main/java/org/openhab/binding/automower/internal/things/AutomowerHandler.java +++ b/bundles/org.openhab.binding.automower/src/main/java/org/openhab/binding/automower/internal/things/AutomowerHandler.java @@ -15,7 +15,6 @@ import static org.openhab.binding.automower.internal.AutomowerBindingConstants.*; import java.time.Instant; -import java.time.ZonedDateTime; import java.util.ArrayList; import java.util.Collection; import java.util.Map; @@ -36,7 +35,6 @@ import org.openhab.binding.automower.internal.rest.api.automowerconnect.dto.RestrictedReason; import org.openhab.binding.automower.internal.rest.api.automowerconnect.dto.State; import org.openhab.binding.automower.internal.rest.exceptions.AutomowerCommunicationException; -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.PointType; @@ -76,7 +74,6 @@ public class AutomowerHandler extends BaseThingHandler { private static final long DEFAULT_POLLING_INTERVAL_S = TimeUnit.MINUTES.toSeconds(10); private final Logger logger = LoggerFactory.getLogger(AutomowerHandler.class); - private final TimeZoneProvider timeZoneProvider; private AtomicReference automowerId = new AtomicReference<>(NO_ID); private long lastQueryTimeMs = 0L; @@ -97,9 +94,8 @@ public class AutomowerHandler extends BaseThingHandler { } }; - public AutomowerHandler(Thing thing, TimeZoneProvider timeZoneProvider) { + public AutomowerHandler(Thing thing) { super(thing); - this.timeZoneProvider = timeZoneProvider; } @Override @@ -287,7 +283,7 @@ private void updateChannelState(@Nullable Mower mower) { } updateState(CHANNEL_STATUS_LAST_UPDATE, - new DateTimeType(toZonedDateTime(mower.getAttributes().getMetadata().getStatusTimestamp()))); + new DateTimeType(Instant.ofEpochMilli(mower.getAttributes().getMetadata().getStatusTimestamp()))); updateState(CHANNEL_STATUS_BATTERY, new QuantityType<>(mower.getAttributes().getBattery().getBatteryPercent(), Units.PERCENT)); @@ -297,7 +293,7 @@ private void updateChannelState(@Nullable Mower mower) { if (errorCodeTimestamp == 0L) { updateState(CHANNEL_STATUS_ERROR_TIMESTAMP, UnDefType.NULL); } else { - updateState(CHANNEL_STATUS_ERROR_TIMESTAMP, new DateTimeType(toZonedDateTime(errorCodeTimestamp))); + updateState(CHANNEL_STATUS_ERROR_TIMESTAMP, new DateTimeType(Instant.ofEpochMilli(errorCodeTimestamp))); } long nextStartTimestamp = mower.getAttributes().getPlanner().getNextStartTimestamp(); @@ -305,7 +301,7 @@ private void updateChannelState(@Nullable Mower mower) { if (nextStartTimestamp == 0L) { updateState(CHANNEL_PLANNER_NEXT_START, UnDefType.NULL); } else { - updateState(CHANNEL_PLANNER_NEXT_START, new DateTimeType(toZonedDateTime(nextStartTimestamp))); + updateState(CHANNEL_PLANNER_NEXT_START, new DateTimeType(Instant.ofEpochMilli(nextStartTimestamp))); } updateState(CHANNEL_PLANNER_OVERRIDE_ACTION, new StringType(mower.getAttributes().getPlanner().getOverride().getAction())); @@ -339,18 +335,4 @@ private void initializeProperties(@Nullable Mower mower) { updateProperties(properties); } - - /** - * Converts timestamp returned by the Automower API into local time-zone. - * Timestamp returned by the API doesn't have offset and it always in the current time zone - it can be treated as - * UTC. - * Method builds a ZonedDateTime with same hour value but in the current system timezone. - * - * @param timestamp - Automower API timestamp - * @return ZonedDateTime in system timezone - */ - private ZonedDateTime toZonedDateTime(long timestamp) { - Instant timestampInstant = Instant.ofEpochMilli(timestamp); - return ZonedDateTime.ofInstant(timestampInstant, timeZoneProvider.getTimeZone()); - } } From 1231e7d2e9873cf004595adeb9912c6d854648fc Mon Sep 17 00:00:00 2001 From: Jacob Laursen Date: Tue, 10 Dec 2024 21:32:54 +0100 Subject: [PATCH 04/85] Simplify DateTimeType handling for AVM FRITZ! Signed-off-by: Jacob Laursen --- .../internal/handler/AVMFritzBaseThingHandler.java | 6 ++---- .../internal/handler/AVMFritzButtonHandler.java | 10 +++------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/AVMFritzBaseThingHandler.java b/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/AVMFritzBaseThingHandler.java index ff4e72c294e39..167cfe87e7533 100644 --- a/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/AVMFritzBaseThingHandler.java +++ b/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/AVMFritzBaseThingHandler.java @@ -59,7 +59,6 @@ import java.math.BigDecimal; import java.time.Instant; -import java.time.ZoneId; import java.time.ZonedDateTime; import java.util.Map; @@ -314,9 +313,8 @@ private void updateHeatingThermostat(@Nullable HeatingModel heatingModel) { NextChangeModel nextChange = heatingModel.getNextchange(); if (nextChange != null) { int endPeriod = nextChange.getEndperiod(); - updateThingChannelState(CHANNEL_NEXT_CHANGE, endPeriod == 0 ? UnDefType.UNDEF - : new DateTimeType( - ZonedDateTime.ofInstant(Instant.ofEpochSecond(endPeriod), ZoneId.systemDefault()))); + updateThingChannelState(CHANNEL_NEXT_CHANGE, + endPeriod == 0 ? UnDefType.UNDEF : new DateTimeType(Instant.ofEpochSecond(endPeriod))); BigDecimal nextTemperature = nextChange.getTchange(); updateThingChannelState(CHANNEL_NEXTTEMP, TEMP_FRITZ_UNDEFINED.equals(nextTemperature) ? UnDefType.UNDEF : new QuantityType<>(toCelsius(nextTemperature), SIUnits.CELSIUS)); diff --git a/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/AVMFritzButtonHandler.java b/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/AVMFritzButtonHandler.java index 5af35748fb28a..5078413186b24 100644 --- a/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/AVMFritzButtonHandler.java +++ b/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/AVMFritzButtonHandler.java @@ -16,8 +16,6 @@ import java.math.BigDecimal; import java.time.Instant; -import java.time.ZoneId; -import java.time.ZonedDateTime; import java.util.List; import java.util.Optional; @@ -189,13 +187,11 @@ private void updateButton(ButtonModel buttonModel, String event, @Nullable Strin : channelGroupId + ChannelUID.CHANNEL_GROUP_SEPARATOR + CHANNEL_LAST_CHANGE, UnDefType.UNDEF); } else { - ZonedDateTime timestamp = ZonedDateTime.ofInstant(Instant.ofEpochSecond(lastPressedTimestamp), - ZoneId.systemDefault()); - Instant then = timestamp.toInstant(); + Instant timestamp = Instant.ofEpochSecond(lastPressedTimestamp); // Avoid dispatching events if "lastpressedtimestamp" is older than now "lastTimestamp" (e.g. during // restart) - if (then.isAfter(lastTimestamp)) { - lastTimestamp = then; + if (timestamp.isAfter(lastTimestamp)) { + lastTimestamp = timestamp; triggerThingChannel(channelGroupId == null ? CHANNEL_PRESS : channelGroupId + ChannelUID.CHANNEL_GROUP_SEPARATOR + CHANNEL_PRESS, event); } From a8e2348d5a9a68f5dd8154fadb3fd7a5a58fc37d Mon Sep 17 00:00:00 2001 From: Jacob Laursen Date: Mon, 11 Nov 2024 20:28:16 +0100 Subject: [PATCH 05/85] Simplify DateTimeType handling for aWATTar Signed-off-by: Jacob Laursen --- .../org/openhab/binding/awattar/internal/AwattarUtil.java | 5 ----- .../awattar/internal/handler/AwattarBestPriceHandler.java | 6 +++--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/bundles/org.openhab.binding.awattar/src/main/java/org/openhab/binding/awattar/internal/AwattarUtil.java b/bundles/org.openhab.binding.awattar/src/main/java/org/openhab/binding/awattar/internal/AwattarUtil.java index e6ba28341c077..37ee5e6695585 100644 --- a/bundles/org.openhab.binding.awattar/src/main/java/org/openhab/binding/awattar/internal/AwattarUtil.java +++ b/bundles/org.openhab.binding.awattar/src/main/java/org/openhab/binding/awattar/internal/AwattarUtil.java @@ -21,7 +21,6 @@ import org.eclipse.jdt.annotation.NonNullByDefault; 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.unit.Units; @@ -47,10 +46,6 @@ public static ZonedDateTime getCalendarForHour(int hour, ZoneId zone) { return ZonedDateTime.now(zone).truncatedTo(ChronoUnit.DAYS).plusHours(hour); } - public static DateTimeType getDateTimeType(long time, TimeZoneProvider tz) { - return new DateTimeType(ZonedDateTime.ofInstant(Instant.ofEpochMilli(time), tz.getTimeZone())); - } - public static QuantityType