Simplify DateTimeType handling for Flume

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
Jacob Laursen 2024-11-10 00:33:11 +01:00 committed by lsiepel
parent c594446eac
commit 698939cf46

View File

@ -20,7 +20,6 @@ import java.time.Duration;
import java.time.Instant; import java.time.Instant;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
@ -193,8 +192,7 @@ public class FlumeDeviceHandler extends BaseThingHandler {
updateState(CHANNEL_DEVICE_LOWBATTERY, (percent <= 25) ? OnOffType.ON : OnOffType.OFF); updateState(CHANNEL_DEVICE_LOWBATTERY, (percent <= 25) ? OnOffType.ON : OnOffType.OFF);
break; break;
case CHANNEL_DEVICE_LASTSEEN: case CHANNEL_DEVICE_LASTSEEN:
updateState(CHANNEL_DEVICE_LASTSEEN, updateState(CHANNEL_DEVICE_LASTSEEN, new DateTimeType(apiDevice.lastSeen));
new DateTimeType(ZonedDateTime.ofInstant(apiDevice.lastSeen, ZoneId.systemDefault())));
break; break;
} }
} }