Skip to content

Commit

Permalink
[miio] Fix date parsing issue last cleaning details (#16380)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelrv committed Feb 6, 2024
1 parent 7a5802b commit 8b2148e
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -541,12 +541,14 @@ private void updateHistoryRecordLegacy(JsonArray historyData) {
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());
Expand Down

0 comments on commit 8b2148e

Please sign in to comment.