Simplify DateTimeType handling for Millheat

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

View File

@ -420,7 +420,7 @@ public class MillheatAccountHandler extends BaseBridgeHandler {
try { try {
switch (property) { switch (property) {
case SetHolidayParameterRequest.PROP_START: { case SetHolidayParameterRequest.PROP_START: {
long epoch = ((DateTimeType) command).getZonedDateTime().toEpochSecond(); long epoch = ((DateTimeType) command).getInstant().getEpochSecond();
SetHolidayParameterRequest req = new SetHolidayParameterRequest(home.getId(), home.getTimezone(), SetHolidayParameterRequest req = new SetHolidayParameterRequest(home.getId(), home.getTimezone(),
SetHolidayParameterRequest.PROP_START, epoch); SetHolidayParameterRequest.PROP_START, epoch);
if (sendLoggedInRequest(req, SetHolidayParameterResponse.class).isSuccess()) { if (sendLoggedInRequest(req, SetHolidayParameterResponse.class).isSuccess()) {
@ -429,7 +429,7 @@ public class MillheatAccountHandler extends BaseBridgeHandler {
break; break;
} }
case SetHolidayParameterRequest.PROP_END: { case SetHolidayParameterRequest.PROP_END: {
long epoch = ((DateTimeType) command).getZonedDateTime().toEpochSecond(); long epoch = ((DateTimeType) command).getInstant().getEpochSecond();
SetHolidayParameterRequest req = new SetHolidayParameterRequest(home.getId(), home.getTimezone(), SetHolidayParameterRequest req = new SetHolidayParameterRequest(home.getId(), home.getTimezone(),
SetHolidayParameterRequest.PROP_END, epoch); SetHolidayParameterRequest.PROP_END, epoch);
if (sendLoggedInRequest(req, SetHolidayParameterResponse.class).isSuccess()) { if (sendLoggedInRequest(req, SetHolidayParameterResponse.class).isSuccess()) {