]> git.basschouten.com Git - openhab-addons.git/commitdiff
[miio] Fix date parsing issue last cleaning details (#16380)
authorMarcel <marcel@verpaalen.com>
Tue, 6 Feb 2024 19:33:32 +0000 (20:33 +0100)
committerGitHub <noreply@github.com>
Tue, 6 Feb 2024 19:33:32 +0000 (20:33 +0100)
https://community.openhab.org/t/miio-binding-roborock-s4max-no-longer-getting-last-cleaning-details/153260/3

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoVacuumHandler.java

index cae9bb8a7676521a903bb85fbb9922dc42ff40bc..8474f8ed545c2f47669f16be5bd8abaa4e8b5dd6 100644 (file)
@@ -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());