mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 07:02:02 +01:00
Simplify DateTimeType handling for Hydrawise
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
28b6624644
commit
fb7ba1feb1
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user