mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
Simplify DateTimeType handling for PLCLogo
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
225ebd9c83
commit
1af326dbb7
@ -14,6 +14,7 @@ package org.openhab.binding.plclogo.internal.handler;
|
|||||||
|
|
||||||
import static org.openhab.binding.plclogo.internal.PLCLogoBindingConstants.*;
|
import static org.openhab.binding.plclogo.internal.PLCLogoBindingConstants.*;
|
||||||
|
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -93,7 +94,7 @@ public class PLCDateTimeHandler extends PLCCommonHandler {
|
|||||||
byte[] buffer = new byte[2];
|
byte[] buffer = new byte[2];
|
||||||
String type = channel.getAcceptedItemType();
|
String type = channel.getAcceptedItemType();
|
||||||
if (DATE_TIME_ITEM.equalsIgnoreCase(type)) {
|
if (DATE_TIME_ITEM.equalsIgnoreCase(type)) {
|
||||||
ZonedDateTime datetime = dateTimeCommand.getZonedDateTime();
|
ZonedDateTime datetime = dateTimeCommand.getZonedDateTime(ZoneId.systemDefault());
|
||||||
if ("Time".equalsIgnoreCase(channelUID.getId())) {
|
if ("Time".equalsIgnoreCase(channelUID.getId())) {
|
||||||
buffer[0] = S7.ByteToBCD(datetime.getHour());
|
buffer[0] = S7.ByteToBCD(datetime.getHour());
|
||||||
buffer[1] = S7.ByteToBCD(datetime.getMinute());
|
buffer[1] = S7.ByteToBCD(datetime.getMinute());
|
||||||
|
Loading…
Reference in New Issue
Block a user