mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 07:02:02 +01:00
Simplify DateTimeType handling for Enphase
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
4c176a8c82
commit
d5d01b0623
@ -15,8 +15,6 @@ package org.openhab.binding.enphase.internal.handler;
|
||||
import static org.openhab.binding.enphase.internal.EnphaseBindingConstants.*;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
@ -92,11 +90,7 @@ public class EnphaseInverterHandler extends EnphaseDeviceHandler {
|
||||
if (inverterDTO == null) {
|
||||
state = UnDefType.UNDEF;
|
||||
} else {
|
||||
final Instant instant = Instant.ofEpochSecond(inverterDTO.lastReportDate);
|
||||
final ZonedDateTime zonedDateTime = instant.atZone(ZoneId.systemDefault());
|
||||
logger.trace("[{}] Epoch time {}, zonedDateTime: {}", getThing().getUID(), inverterDTO.lastReportDate,
|
||||
zonedDateTime);
|
||||
state = new DateTimeType(zonedDateTime);
|
||||
state = new DateTimeType(Instant.ofEpochSecond(inverterDTO.lastReportDate));
|
||||
}
|
||||
updateState(INVERTER_CHANNEL_LAST_REPORT_DATE, state);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user