mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
Simplify DateTimeType handling for OJElectronics
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
e60fc3e40c
commit
b23cb757c4
@ -212,7 +212,7 @@ public class ThermostatHandler extends BaseThingHandler {
|
|||||||
|
|
||||||
private void updateBoostEndTime(Command command) {
|
private void updateBoostEndTime(Command command) {
|
||||||
if (command instanceof DateTimeType dateTimeCommand) {
|
if (command instanceof DateTimeType dateTimeCommand) {
|
||||||
getCurrentThermostat().boostEndTime = Date.from(dateTimeCommand.getZonedDateTime().toInstant());
|
getCurrentThermostat().boostEndTime = Date.from(dateTimeCommand.getInstant());
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Unable to set value {}", command);
|
logger.warn("Unable to set value {}", command);
|
||||||
}
|
}
|
||||||
@ -225,8 +225,7 @@ public class ThermostatHandler extends BaseThingHandler {
|
|||||||
|
|
||||||
private void updateComfortEndTime(Command command) {
|
private void updateComfortEndTime(Command command) {
|
||||||
if (command instanceof DateTimeType dateTimeCommand) {
|
if (command instanceof DateTimeType dateTimeCommand) {
|
||||||
getCurrentThermostat().comfortEndTime = Objects
|
getCurrentThermostat().comfortEndTime = Objects.requireNonNull(Date.from(dateTimeCommand.getInstant()));
|
||||||
.requireNonNull(Date.from(dateTimeCommand.getZonedDateTime().toInstant()));
|
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Unable to set value {}", command);
|
logger.warn("Unable to set value {}", command);
|
||||||
}
|
}
|
||||||
@ -329,7 +328,7 @@ public class ThermostatHandler extends BaseThingHandler {
|
|||||||
private void updateVacationBeginDay(Command command) {
|
private void updateVacationBeginDay(Command command) {
|
||||||
if (command instanceof DateTimeType dateTimeCommand) {
|
if (command instanceof DateTimeType dateTimeCommand) {
|
||||||
getCurrentThermostat().vacationBeginDay = Date
|
getCurrentThermostat().vacationBeginDay = Date
|
||||||
.from(dateTimeCommand.getZonedDateTime().toInstant().truncatedTo(ChronoUnit.DAYS));
|
.from(dateTimeCommand.getInstant().truncatedTo(ChronoUnit.DAYS));
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Unable to set value {}", command);
|
logger.warn("Unable to set value {}", command);
|
||||||
}
|
}
|
||||||
@ -345,7 +344,7 @@ public class ThermostatHandler extends BaseThingHandler {
|
|||||||
private void updateVacationEndDay(Command command) {
|
private void updateVacationEndDay(Command command) {
|
||||||
if (command instanceof DateTimeType dateTimeCommand) {
|
if (command instanceof DateTimeType dateTimeCommand) {
|
||||||
getCurrentThermostat().vacationEndDay = Date
|
getCurrentThermostat().vacationEndDay = Date
|
||||||
.from(dateTimeCommand.getZonedDateTime().toInstant().truncatedTo(ChronoUnit.DAYS));
|
.from(dateTimeCommand.getInstant().truncatedTo(ChronoUnit.DAYS));
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Unable to set value {}", command);
|
logger.warn("Unable to set value {}", command);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user