[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 <marcel@verpaalen.com>pull/16330/head
parent
7a5802b09a
commit
8b2148e121
|
@ -541,12 +541,14 @@ public class MiIoVacuumHandler extends MiIoAbstractHandler {
|
||||||
private void updateHistoryRecord(HistoryRecordDTO historyRecordDTO) {
|
private void updateHistoryRecord(HistoryRecordDTO historyRecordDTO) {
|
||||||
JsonObject historyRecord = GSON.toJsonTree(historyRecordDTO).getAsJsonObject();
|
JsonObject historyRecord = GSON.toJsonTree(historyRecordDTO).getAsJsonObject();
|
||||||
if (historyRecordDTO.getStart() != null) {
|
if (historyRecordDTO.getStart() != null) {
|
||||||
historyRecord.addProperty("start", historyRecordDTO.getStart().split("\\+")[0]);
|
historyRecord.addProperty("start", historyRecordDTO.getStart().split("\\+")[0].split("\\-")[0]);
|
||||||
updateState(CHANNEL_HISTORY_START_TIME, new DateTimeType(historyRecordDTO.getStart().split("\\+")[0]));
|
updateState(CHANNEL_HISTORY_START_TIME,
|
||||||
|
new DateTimeType(historyRecordDTO.getStart().split("\\+")[0].split("\\-")[0]));
|
||||||
}
|
}
|
||||||
if (historyRecordDTO.getEnd() != null) {
|
if (historyRecordDTO.getEnd() != null) {
|
||||||
historyRecord.addProperty("end", historyRecordDTO.getEnd().split("\\+")[0]);
|
historyRecord.addProperty("end", historyRecordDTO.getEnd().split("\\+")[0].split("\\-")[0]);
|
||||||
updateState(CHANNEL_HISTORY_END_TIME, new DateTimeType(historyRecordDTO.getEnd().split("\\+")[0]));
|
updateState(CHANNEL_HISTORY_END_TIME,
|
||||||
|
new DateTimeType(historyRecordDTO.getEnd().split("\\+")[0].split("\\-")[0]));
|
||||||
}
|
}
|
||||||
if (historyRecordDTO.getDuration() != null) {
|
if (historyRecordDTO.getDuration() != null) {
|
||||||
long duration = TimeUnit.SECONDS.toMinutes(historyRecordDTO.getDuration().longValue());
|
long duration = TimeUnit.SECONDS.toMinutes(historyRecordDTO.getDuration().longValue());
|
||||||
|
|
Loading…
Reference in New Issue