mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
Simplify DateTimeType handling for UniFi
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
a6f9977e29
commit
77d6457017
@ -14,8 +14,6 @@ package org.openhab.binding.unifi.internal.handler;
|
|||||||
|
|
||||||
import static org.openhab.binding.unifi.internal.UniFiBindingConstants.*;
|
import static org.openhab.binding.unifi.internal.UniFiBindingConstants.*;
|
||||||
|
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
@ -144,7 +142,7 @@ public class UniFiAccessPointThingHandler extends UniFiBaseThingHandler<UniFiDev
|
|||||||
break;
|
break;
|
||||||
case CHANNEL_LAST_SEEN:
|
case CHANNEL_LAST_SEEN:
|
||||||
if (device.getLastSeen() != null) {
|
if (device.getLastSeen() != null) {
|
||||||
state = new DateTimeType(ZonedDateTime.ofInstant(device.getLastSeen(), ZoneId.systemDefault()));
|
state = new DateTimeType(device.getLastSeen());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CHANNEL_EXPERIENCE:
|
case CHANNEL_EXPERIENCE:
|
||||||
|
@ -33,8 +33,6 @@ import static org.openhab.core.thing.ThingStatus.OFFLINE;
|
|||||||
import static org.openhab.core.thing.ThingStatusDetail.CONFIGURATION_ERROR;
|
import static org.openhab.core.thing.ThingStatusDetail.CONFIGURATION_ERROR;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
@ -222,7 +220,7 @@ public class UniFiClientThingHandler extends UniFiBaseThingHandler<UniFiClient,
|
|||||||
case CHANNEL_LAST_SEEN:
|
case CHANNEL_LAST_SEEN:
|
||||||
// mgb: we don't check clientOnline as lastSeen is also included in the Insights data
|
// mgb: we don't check clientOnline as lastSeen is also included in the Insights data
|
||||||
if (client.getLastSeen() != null) {
|
if (client.getLastSeen() != null) {
|
||||||
state = new DateTimeType(ZonedDateTime.ofInstant(client.getLastSeen(), ZoneId.systemDefault()));
|
state = new DateTimeType(client.getLastSeen());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user