Skip to content

Commit

Permalink
fix: parsing potential list of clean record (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lash-L authored Sep 28, 2023
1 parent ccb18f3 commit df7a920
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion roborock/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,16 @@ async def get_clean_summary(self) -> CleanSummary | None:
return None

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

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

0 comments on commit df7a920

Please sign in to comment.