diff --git a/bundles/org.openhab.binding.freebox/src/main/java/org/openhab/binding/freebox/internal/FreeboxHandlerFactory.java b/bundles/org.openhab.binding.freebox/src/main/java/org/openhab/binding/freebox/internal/FreeboxHandlerFactory.java index 8f25888e99721..bf45edec39622 100644 --- a/bundles/org.openhab.binding.freebox/src/main/java/org/openhab/binding/freebox/internal/FreeboxHandlerFactory.java +++ b/bundles/org.openhab.binding.freebox/src/main/java/org/openhab/binding/freebox/internal/FreeboxHandlerFactory.java @@ -124,7 +124,7 @@ public boolean supportsThingType(ThingTypeUID thingTypeUID) { registerDiscoveryService(handler); return handler; } else if (FreeboxBindingConstants.SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID)) { - FreeboxThingHandler handler = new FreeboxThingHandler(thing, timeZoneProvider.getTimeZone()); + FreeboxThingHandler handler = new FreeboxThingHandler(thing, timeZoneProvider); if (FreeboxBindingConstants.FREEBOX_THING_TYPE_AIRPLAY.equals(thingTypeUID)) { registerAudioSink(handler); } diff --git a/bundles/org.openhab.binding.freebox/src/main/java/org/openhab/binding/freebox/internal/handler/FreeboxThingHandler.java b/bundles/org.openhab.binding.freebox/src/main/java/org/openhab/binding/freebox/internal/handler/FreeboxThingHandler.java index 85a5a058abb37..cdea788a07fe1 100644 --- a/bundles/org.openhab.binding.freebox/src/main/java/org/openhab/binding/freebox/internal/handler/FreeboxThingHandler.java +++ b/bundles/org.openhab.binding.freebox/src/main/java/org/openhab/binding/freebox/internal/handler/FreeboxThingHandler.java @@ -15,7 +15,6 @@ import static org.openhab.binding.freebox.internal.FreeboxBindingConstants.*; import java.time.Instant; -import java.time.ZoneId; import java.time.ZonedDateTime; import java.util.Calendar; import java.util.Collections; @@ -24,6 +23,7 @@ import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; +import org.eclipse.smarthome.core.i18n.TimeZoneProvider; import org.eclipse.smarthome.core.library.types.DateTimeType; import org.eclipse.smarthome.core.library.types.DecimalType; import org.eclipse.smarthome.core.library.types.OnOffType; @@ -62,7 +62,8 @@ public class FreeboxThingHandler extends BaseThingHandler { private final Logger logger = LoggerFactory.getLogger(FreeboxThingHandler.class); - private final ZoneId zoneId; + private final TimeZoneProvider timeZoneProvider; + private ScheduledFuture phoneJob; private ScheduledFuture callsJob; private FreeboxHandler bridgeHandler; @@ -71,9 +72,9 @@ public class FreeboxThingHandler extends BaseThingHandler { private String airPlayName; private String airPlayPassword; - public FreeboxThingHandler(Thing thing, ZoneId zoneId) { + public FreeboxThingHandler(Thing thing, TimeZoneProvider timeZoneProvider) { super(thing); - this.zoneId = zoneId; + this.timeZoneProvider = timeZoneProvider; } @Override @@ -262,7 +263,7 @@ private void updateCall(FreeboxCallEntry call, String channelGroup) { updateGroupChannelStringState(channelGroup, CALLNUMBER, call.getNumber()); updateGroupChannelDecimalState(channelGroup, CALLDURATION, call.getDuration()); ZonedDateTime zoned = ZonedDateTime.ofInstant(Instant.ofEpochMilli(call.getTimeStamp().getTimeInMillis()), - zoneId); + timeZoneProvider.getTimeZone()); updateGroupChannelDateTimeState(channelGroup, CALLTIMESTAMP, zoned); updateGroupChannelStringState(channelGroup, CALLNAME, call.getName()); if (channelGroup.equals(ANY)) {