mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
Simplify DateTimeType handling for Bosch Indego
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
parent
b1eae44633
commit
e7130bb4be
@ -18,7 +18,6 @@ import java.nio.charset.StandardCharsets;
|
|||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -448,12 +447,7 @@ public class BoschIndegoHandler extends BaseThingHandler implements Authorizatio
|
|||||||
private void refreshLastCuttingTime() throws IndegoAuthenticationException, IndegoException {
|
private void refreshLastCuttingTime() throws IndegoAuthenticationException, IndegoException {
|
||||||
if (isLinked(LAST_CUTTING)) {
|
if (isLinked(LAST_CUTTING)) {
|
||||||
Instant lastCutting = controller.getPredictiveLastCutting();
|
Instant lastCutting = controller.getPredictiveLastCutting();
|
||||||
if (lastCutting != null) {
|
updateState(LAST_CUTTING, lastCutting == null ? UnDefType.UNDEF : new DateTimeType(lastCutting));
|
||||||
updateState(LAST_CUTTING,
|
|
||||||
new DateTimeType(ZonedDateTime.ofInstant(lastCutting, timeZoneProvider.getTimeZone())));
|
|
||||||
} else {
|
|
||||||
updateState(LAST_CUTTING, UnDefType.UNDEF);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,8 +466,7 @@ public class BoschIndegoHandler extends BaseThingHandler implements Authorizatio
|
|||||||
if (isLinked(NEXT_CUTTING)) {
|
if (isLinked(NEXT_CUTTING)) {
|
||||||
Instant nextCutting = controller.getPredictiveNextCutting();
|
Instant nextCutting = controller.getPredictiveNextCutting();
|
||||||
if (nextCutting != null) {
|
if (nextCutting != null) {
|
||||||
updateState(NEXT_CUTTING,
|
updateState(NEXT_CUTTING, new DateTimeType(nextCutting));
|
||||||
new DateTimeType(ZonedDateTime.ofInstant(nextCutting, timeZoneProvider.getTimeZone())));
|
|
||||||
scheduleCuttingTimesRefresh(nextCutting);
|
scheduleCuttingTimesRefresh(nextCutting);
|
||||||
} else {
|
} else {
|
||||||
updateState(NEXT_CUTTING, UnDefType.UNDEF);
|
updateState(NEXT_CUTTING, UnDefType.UNDEF);
|
||||||
|
Loading…
Reference in New Issue
Block a user