From fbc9de915a16ba9ccb16dbe8a3df176316dfeff8 Mon Sep 17 00:00:00 2001 From: Harry Coureau Date: Sun, 15 Nov 2026 15:42:07 +0000 Subject: [PATCH] fix(v1): skip multi-map rooms without a cloud room id get_multi_maps_list can list a room entry with an empty iot_name_id that is absent from get_room_mapping and the map. It was reported as an extra selectable room in the home trait rooms. Treat an empty iot_name_id like a missing one so such entries are skipped. Entries with other ids, such as "-1", are still included. --- roborock/data/v1/v1_containers.py | 2 +- tests/data/v1/test_v1_containers.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/roborock/data/v1/v1_containers.py b/roborock/data/v1/v1_containers.py index 7ff1f97fd..91dc98f0b 100644 --- a/roborock/data/v1/v1_containers.py +++ b/roborock/data/v1/v1_containers.py @@ -431,7 +431,7 @@ class MultiMapsListRoom(RoborockBase): @property def named_room_mapping(self) -> NamedRoomMapping | None: """Returns a NamedRoomMapping object if valid.""" - if self.id is None or self.iot_name_id is None: + if self.id is None or not self.iot_name_id: return None return NamedRoomMapping( segment_id=self.id, diff --git a/tests/data/v1/test_v1_containers.py b/tests/data/v1/test_v1_containers.py index 8ade27b90..ee0bb1963 100644 --- a/tests/data/v1/test_v1_containers.py +++ b/tests/data/v1/test_v1_containers.py @@ -371,6 +371,28 @@ def test_multi_maps_list_info(snapshot: SnapshotAssertion) -> None: assert deserialized == snapshot +def test_multi_maps_list_rooms_map_skips_rooms_without_iot_name_id() -> None: + """Test that room entries with an empty cloud room id are not reported as rooms.""" + maps_list = MultiMapsList.from_dict( + { + "map_info": [ + { + "mapFlag": 0, + "name": "Home", + "rooms": [ + {"id": 1, "tag": 2, "iot_name_id": "1000001", "iot_name": "Kitchen"}, + {"id": 2, "tag": 3, "iot_name_id": "1000002", "iot_name": "Bedroom"}, + {"id": 3, "tag": -1, "iot_name_id": "", "iot_name": "Room"}, + {"id": 4, "tag": -1, "iot_name_id": "-1", "iot_name": "Hall"}, + ], + } + ] + } + ) + assert maps_list.map_info + assert maps_list.map_info[0].rooms_map.keys() == {1, 2, 4} + + def test_accurate_map_flag() -> None: """Test that we parse the map flag accurately.""" s = StatusV2.from_dict(STATUS)