Skip to content

Commit d4046a5

Browse files
committed
fix: FIx bug in clean record parsing
This unpacks the data from the outer list before parsing as another list.
1 parent 904494d commit d4046a5

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

roborock/devices/traits/v1/clean_summary.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ async def get_clean_record(self, record_id: int) -> CleanRecord:
5353
@classmethod
5454
def _parse_clean_record_response(cls, response: common.V1ResponseData) -> CleanRecord:
5555
"""Parse the response from the device into a CleanRecord."""
56+
if isinstance(response, list) and len(response) == 1:
57+
response = response[0]
5658
if isinstance(response, dict):
5759
return CleanRecord.from_dict(response)
5860
if isinstance(response, list):

tests/devices/traits/v1/test_clean_summary.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,17 @@
4040
]
4141

4242
CLEAN_RECORD_DATA = [
43-
1738864366,
44-
1738868964,
45-
4358,
46-
81122500,
47-
0,
48-
0,
49-
1,
50-
1,
51-
21,
43+
[
44+
1738864366,
45+
1738868964,
46+
4358,
47+
81122500,
48+
0,
49+
0,
50+
1,
51+
1,
52+
21,
53+
]
5254
]
5355

5456

0 commit comments

Comments
 (0)