mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
Simplify DateTimeType handling for Ecobee
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
b5f36cbfa8
commit
7cb8bf18ed
@ -14,7 +14,6 @@ package org.openhab.binding.ecobee.internal.handler;
|
|||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
|
|
||||||
import javax.measure.Unit;
|
import javax.measure.Unit;
|
||||||
import javax.measure.quantity.Temperature;
|
import javax.measure.quantity.Temperature;
|
||||||
@ -89,8 +88,7 @@ public final class EcobeeUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static State undefOrDate(@Nullable Instant instant, TimeZoneProvider timeZoneProvider) {
|
public static State undefOrDate(@Nullable Instant instant, TimeZoneProvider timeZoneProvider) {
|
||||||
return instant == null ? UnDefType.UNDEF
|
return instant == null ? UnDefType.UNDEF : new DateTimeType(instant);
|
||||||
: new DateTimeType(ZonedDateTime.ofInstant(instant, timeZoneProvider.getTimeZone()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static State undefOrDate(@Nullable LocalDateTime ldt, TimeZoneProvider timeZoneProvider) {
|
public static State undefOrDate(@Nullable LocalDateTime ldt, TimeZoneProvider timeZoneProvider) {
|
||||||
|
Loading…
Reference in New Issue
Block a user