Simplify DateTimeType handling for LaMetric

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
Jacob Laursen 2024-11-17 21:04:06 +01:00 committed by lsiepel
parent c6087e6b00
commit 32bf72a858

View File

@ -15,6 +15,7 @@ package org.openhab.binding.lametrictime.internal.handler;
import static org.openhab.binding.lametrictime.internal.LaMetricTimeBindingConstants.*;
import java.time.LocalTime;
import java.time.ZoneId;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
@ -53,7 +54,7 @@ public class ClockAppHandler extends AbstractLaMetricTimeAppHandler {
try {
switch (channelUID.getId()) {
case CHANNEL_APP_SET_ALARM: {
LocalTime time = ((DateTimeType) command).getZonedDateTime().toLocalTime();
LocalTime time = ((DateTimeType) command).getZonedDateTime(ZoneId.systemDefault()).toLocalTime();
getDevice().doAction(getWidget(), CoreApps.clock().setAlarm(true, time, null));
updateActiveAppOnDevice();
break;