Simplify DateTimeType handling for Enphase

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
Jacob Laursen 2024-12-09 23:17:09 +01:00 committed by Ciprian Pascu
parent da1e536049
commit ca6854581b

View File

@ -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);
}