diff --git a/bundles/org.openhab.binding.hydrawise/src/main/java/org/openhab/binding/hydrawise/internal/handler/HydrawiseControllerHandler.java b/bundles/org.openhab.binding.hydrawise/src/main/java/org/openhab/binding/hydrawise/internal/handler/HydrawiseControllerHandler.java index 218a9ed92ae..fc2037f5bb6 100644 --- a/bundles/org.openhab.binding.hydrawise/src/main/java/org/openhab/binding/hydrawise/internal/handler/HydrawiseControllerHandler.java +++ b/bundles/org.openhab.binding.hydrawise/src/main/java/org/openhab/binding/hydrawise/internal/handler/HydrawiseControllerHandler.java @@ -16,6 +16,7 @@ import static org.openhab.binding.hydrawise.internal.HydrawiseBindingConstants.* import java.time.Instant; import java.time.OffsetDateTime; +import java.time.ZoneId; import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; @@ -211,20 +212,20 @@ public class HydrawiseControllerHandler extends BaseThingHandler implements Hydr } break; case CHANNEL_ZONE_SUSPENDUNTIL: - if (!(command instanceof DateTimeType)) { + if (!(command instanceof DateTimeType dateTimeCommand)) { logger.warn("Invalid command type for suspend {}", command.getClass().getName()); return; } if (allCommand) { client.suspendAllRelays(controllerId, - ((DateTimeType) command).getZonedDateTime().format(DATE_FORMATTER)); + dateTimeCommand.getZonedDateTime(ZoneId.systemDefault()).format(DATE_FORMATTER)); } else if (zone != null) { client.suspendRelay(zone.id, - ((DateTimeType) command).getZonedDateTime().format(DATE_FORMATTER)); + dateTimeCommand.getZonedDateTime(ZoneId.systemDefault()).format(DATE_FORMATTER)); } break; default: - logger.warn("Uknown channelId {}", channelId); + logger.warn("Unknown channelId {}", channelId); return; } HydrawiseAccountHandler handler = getAccountHandler();