Simplify DateTimeType handling for PLCLogo

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-11-18 20:32:11 +01:00 committed by Ciprian Pascu
parent 60fe66ff3f
commit 73c095f04b

View File

@ -14,6 +14,7 @@ package org.openhab.binding.plclogo.internal.handler;
import static org.openhab.binding.plclogo.internal.PLCLogoBindingConstants.*;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.List;
import java.util.Map;
@ -93,7 +94,7 @@ public class PLCDateTimeHandler extends PLCCommonHandler {
byte[] buffer = new byte[2];
String type = channel.getAcceptedItemType();
if (DATE_TIME_ITEM.equalsIgnoreCase(type)) {
ZonedDateTime datetime = dateTimeCommand.getZonedDateTime();
ZonedDateTime datetime = dateTimeCommand.getZonedDateTime(ZoneId.systemDefault());
if ("Time".equalsIgnoreCase(channelUID.getId())) {
buffer[0] = S7.ByteToBCD(datetime.getHour());
buffer[1] = S7.ByteToBCD(datetime.getMinute());