From: Marcel Date: Tue, 6 Feb 2024 19:33:32 +0000 (+0100) Subject: [miio] Fix date parsing issue last cleaning details (#16380) X-Git-Url: https://git.basschouten.com/?a=commitdiff_plain;h=8b2148e121a18b01c1185416144abaa969eac784;p=openhab-addons.git [miio] Fix date parsing issue last cleaning details (#16380) https://community.openhab.org/t/miio-binding-roborock-s4max-no-longer-getting-last-cleaning-details/153260/3 Signed-off-by: Marcel Verpaalen --- diff --git a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoVacuumHandler.java b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoVacuumHandler.java index cae9bb8a76..8474f8ed54 100644 --- a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoVacuumHandler.java +++ b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoVacuumHandler.java @@ -541,12 +541,14 @@ public class MiIoVacuumHandler extends MiIoAbstractHandler { private void updateHistoryRecord(HistoryRecordDTO historyRecordDTO) { JsonObject historyRecord = GSON.toJsonTree(historyRecordDTO).getAsJsonObject(); if (historyRecordDTO.getStart() != null) { - historyRecord.addProperty("start", historyRecordDTO.getStart().split("\\+")[0]); - updateState(CHANNEL_HISTORY_START_TIME, new DateTimeType(historyRecordDTO.getStart().split("\\+")[0])); + historyRecord.addProperty("start", historyRecordDTO.getStart().split("\\+")[0].split("\\-")[0]); + updateState(CHANNEL_HISTORY_START_TIME, + new DateTimeType(historyRecordDTO.getStart().split("\\+")[0].split("\\-")[0])); } if (historyRecordDTO.getEnd() != null) { - historyRecord.addProperty("end", historyRecordDTO.getEnd().split("\\+")[0]); - updateState(CHANNEL_HISTORY_END_TIME, new DateTimeType(historyRecordDTO.getEnd().split("\\+")[0])); + historyRecord.addProperty("end", historyRecordDTO.getEnd().split("\\+")[0].split("\\-")[0]); + updateState(CHANNEL_HISTORY_END_TIME, + new DateTimeType(historyRecordDTO.getEnd().split("\\+")[0].split("\\-")[0])); } if (historyRecordDTO.getDuration() != null) { long duration = TimeUnit.SECONDS.toMinutes(historyRecordDTO.getDuration().longValue());