Simplify DateTimeType handling for UniFi

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
Jacob Laursen 2024-11-26 23:27:20 +01:00 committed by lsiepel
parent a6f9977e29
commit 77d6457017
2 changed files with 2 additions and 6 deletions

View File

@ -14,8 +14,6 @@ package org.openhab.binding.unifi.internal.handler;
import static org.openhab.binding.unifi.internal.UniFiBindingConstants.*;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault;
@ -144,7 +142,7 @@ public class UniFiAccessPointThingHandler extends UniFiBaseThingHandler<UniFiDev
break;
case CHANNEL_LAST_SEEN:
if (device.getLastSeen() != null) {
state = new DateTimeType(ZonedDateTime.ofInstant(device.getLastSeen(), ZoneId.systemDefault()));
state = new DateTimeType(device.getLastSeen());
}
break;
case CHANNEL_EXPERIENCE:

View File

@ -33,8 +33,6 @@ import static org.openhab.core.thing.ThingStatus.OFFLINE;
import static org.openhab.core.thing.ThingStatusDetail.CONFIGURATION_ERROR;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
@ -222,7 +220,7 @@ public class UniFiClientThingHandler extends UniFiBaseThingHandler<UniFiClient,
case CHANNEL_LAST_SEEN:
// mgb: we don't check clientOnline as lastSeen is also included in the Insights data
if (client.getLastSeen() != null) {
state = new DateTimeType(ZonedDateTime.ofInstant(client.getLastSeen(), ZoneId.systemDefault()));
state = new DateTimeType(client.getLastSeen());
}
break;