From 8b2148e121a18b01c1185416144abaa969eac784 Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 6 Feb 2024 20:33:32 +0100 Subject: [PATCH] [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 --- .../miio/internal/handler/MiIoVacuumHandler.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 cae9bb8a767..8474f8ed545 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());