Skip to content

Commit 9188b2c

Browse files
committed
fix: support home discovery when there are no maps
1 parent f0eb62a commit 9188b2c

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

roborock/devices/traits/v1/home.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,10 @@ async def discover_home(self) -> None:
107107

108108
await self._maps_trait.refresh()
109109
if self._maps_trait.current_map_info is None:
110-
raise RoborockException("Cannot perform home discovery without current map info")
110+
_LOGGER.debug("Cannot perform home discovery without current map info")
111+
self._discovery_completed = True
112+
await self._update_home_cache({}, {})
113+
return
111114

112115
home_map_info, home_map_content = await self._build_home_map_info()
113116
_LOGGER.debug("Home discovery complete, caching data for %d maps", len(home_map_info))
@@ -198,7 +201,8 @@ async def refresh(self) -> None:
198201
if (current_map_info := self._maps_trait.current_map_info) is None or (
199202
map_flag := self._maps_trait.current_map
200203
) is None:
201-
raise RoborockException("Cannot refresh home data without current map info")
204+
_LOGGER.debug("Cannot refresh home data without current map info")
205+
return
202206

203207
# Refresh the map content to ensure we have the latest image and object positions
204208
new_map_content = await self._refresh_map_content()

tests/devices/traits/v1/test_home.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,10 @@ async def test_discover_home_no_maps(
370370
[{"max_multi_map": 0, "max_bak_map": 0, "multi_map_count": 0, "map_info": []}]
371371
]
372372

373-
with pytest.raises(Exception, match="Cannot perform home discovery without current map info"):
374-
await home_trait.discover_home()
373+
await home_trait.discover_home()
374+
375+
assert home_trait.home_map_info == {}
376+
assert home_trait.home_map_content == {}
375377

376378

377379
async def test_refresh_updates_current_map_cache(

0 commit comments

Comments
 (0)