mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
Simplify DateTimeType handling for VeSync
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
d59b10a064
commit
7c1892fd57
@ -15,8 +15,7 @@ package org.openhab.binding.vesync.internal.handlers;
|
|||||||
import static org.openhab.binding.vesync.internal.VeSyncConstants.*;
|
import static org.openhab.binding.vesync.internal.VeSyncConstants.*;
|
||||||
import static org.openhab.binding.vesync.internal.dto.requests.VeSyncProtocolConstants.*;
|
import static org.openhab.binding.vesync.internal.dto.requests.VeSyncProtocolConstants.*;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.Instant;
|
||||||
import java.time.temporal.ChronoUnit;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -527,8 +526,8 @@ public class VeSyncDeviceAirPurifierHandler extends VeSyncBaseDeviceHandler {
|
|||||||
// Only 400S appears to have this JSON extension object
|
// Only 400S appears to have this JSON extension object
|
||||||
if (purifierStatus.result.result.extension != null) {
|
if (purifierStatus.result.result.extension != null) {
|
||||||
if (purifierStatus.result.result.extension.timerRemain > 0) {
|
if (purifierStatus.result.result.extension.timerRemain > 0) {
|
||||||
updateState(DEVICE_CHANNEL_AF_AUTO_OFF_CALC_TIME, new DateTimeType(LocalDateTime.now()
|
updateState(DEVICE_CHANNEL_AF_AUTO_OFF_CALC_TIME, new DateTimeType(
|
||||||
.plus(purifierStatus.result.result.extension.timerRemain, ChronoUnit.SECONDS).toString()));
|
Instant.now().plusSeconds(purifierStatus.result.result.extension.timerRemain)));
|
||||||
} else {
|
} else {
|
||||||
updateState(DEVICE_CHANNEL_AF_AUTO_OFF_CALC_TIME, new DateTimeItem("nullEnforcements").getState());
|
updateState(DEVICE_CHANNEL_AF_AUTO_OFF_CALC_TIME, new DateTimeItem("nullEnforcements").getState());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user