Skip to content

Commit df7a920

Browse files
authored
fix: parsing potential list of clean record (#125)
1 parent ccb18f3 commit df7a920

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

roborock/api.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,16 @@ async def get_clean_summary(self) -> CleanSummary | None:
437437
return None
438438

439439
async def get_clean_record(self, record_id: int) -> CleanRecord | None:
440-
return await self.send_command(RoborockCommand.GET_CLEAN_RECORD, [record_id], return_type=CleanRecord)
440+
record: dict | list = await self.send_command(RoborockCommand.GET_CLEAN_RECORD, [record_id])
441+
if isinstance(record, dict):
442+
return CleanRecord.from_dict(record)
443+
elif isinstance(record, list):
444+
# There are still a few unknown variables in this.
445+
begin, end, duration, area = unpack_list(record, 4)
446+
return CleanRecord(begin=begin, end=end, duration=duration, area=area)
447+
else:
448+
_LOGGER.warning("Clean record was of a new type, please submit an issue request: %s", record)
449+
return None
441450

442451
async def get_consumable(self) -> Consumable | None:
443452
return Consumable.from_dict(await self.cache[CacheableAttribute.consumable].async_value())

0 commit comments

Comments
 (0)