Skip to content

Commit c71d3b5

Browse files
fix: ignoring get_room_mapping for int list response
1 parent 3e1cb35 commit c71d3b5

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

roborock/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ async def get_room_mapping(self) -> list[RoomMapping] | None:
365365
if isinstance(mapping, list):
366366
return [
367367
RoomMapping(segment_id=segment_id, iot_id=iot_id) # type: ignore
368-
for segment_id, iot_id in [unpack_list(room, 2) for room in mapping]
368+
for segment_id, iot_id in [unpack_list(room, 2) for room in mapping if isinstance(room, list)]
369369
]
370370
return None
371371

roborock/code_mappings.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ class RoborockEnum(IntEnum):
1212

1313
@classmethod
1414
def _missing_(cls: Type[RoborockEnum], key) -> RoborockEnum:
15-
if hasattr(cls, "missing"):
16-
_LOGGER.warning(f"Missing {cls.__name__} code: {key} - defaulting to 'missing'")
17-
return cls.missing # type: ignore
15+
if hasattr(cls, "unknown"):
16+
_LOGGER.warning(f"Missing {cls.__name__} code: {key} - defaulting to 'unknown'")
17+
return cls.unknown # type: ignore
1818
default_value = next(item for item in cls)
1919
_LOGGER.warning(f"Missing {cls.__name__} code: {key} - defaulting to {default_value}")
2020
return default_value
@@ -221,8 +221,9 @@ class RoborockDockErrorCode(RoborockEnum):
221221

222222

223223
class RoborockDockTypeCode(RoborockEnum):
224-
missing = -9999
224+
unknown = -9999
225225
no_dock = 0
226+
auto_empty_dock = 1
226227
empty_wash_fill_dock = 3
227228
auto_empty_dock_pure = 5
228229
s8_dock = 7
@@ -232,7 +233,7 @@ class RoborockDockDustCollectionModeCode(RoborockEnum):
232233
"""Describes the dust collection mode of the vacuum cleaner."""
233234

234235
# TODO: Get the correct values for various different docks
235-
missing = -9999
236+
unknown = -9999
236237
smart = 0
237238
light = 1
238239
balanced = 2
@@ -243,7 +244,7 @@ class RoborockDockWashTowelModeCode(RoborockEnum):
243244
"""Describes the wash towel mode of the vacuum cleaner."""
244245

245246
# TODO: Get the correct values for various different docks
246-
missing = -9999
247+
unknown = -9999
247248
light = 0
248249
balanced = 1
249250
deep = 2

tests/test_containers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,6 @@ def test_no_value():
196196
modified_status = STATUS.copy()
197197
modified_status["dock_type"] = 9999
198198
s = S7MaxVStatus.from_dict(modified_status)
199-
assert s.dock_type == RoborockDockTypeCode.missing
199+
assert s.dock_type == RoborockDockTypeCode.unknown
200200
assert -9999 not in RoborockDockTypeCode.keys()
201201
assert "missing" not in RoborockDockTypeCode.values()

0 commit comments

Comments
 (0)