Simplify DateTimeType handling for Broadlink

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
Jacob Laursen 2024-11-16 12:22:01 +01:00 committed by lsiepel
parent c02a7345e1
commit bb9a789d31

View File

@ -16,6 +16,7 @@ import static org.openhab.binding.broadlinkthermostat.internal.BroadlinkBindingC
import java.io.IOException; import java.io.IOException;
import java.time.LocalTime; import java.time.LocalTime;
import java.time.ZoneId;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -212,7 +213,7 @@ public class FloureonThermostatHandler extends BroadlinkBaseHandler {
private void handleSetTimeCommand(ChannelUID channelUID, Command command) { private void handleSetTimeCommand(ChannelUID channelUID, Command command) {
if (command instanceof DateTimeType dateTimeCommand) { if (command instanceof DateTimeType dateTimeCommand) {
ZonedDateTime zonedDateTime = dateTimeCommand.getZonedDateTime(); ZonedDateTime zonedDateTime = dateTimeCommand.getZonedDateTime(ZoneId.systemDefault());
try { try {
new SetTimeCommand(tob(zonedDateTime.getHour()), tob(zonedDateTime.getMinute()), new SetTimeCommand(tob(zonedDateTime.getHour()), tob(zonedDateTime.getMinute()),
tob(zonedDateTime.getSecond()), tob(zonedDateTime.getDayOfWeek().getValue())) tob(zonedDateTime.getSecond()), tob(zonedDateTime.getDayOfWeek().getValue()))