From 6b276e0cd33dd2e3d6eb6582e3dfedd72e52b6d7 Mon Sep 17 00:00:00 2001 From: johnmph Date: Mon, 2 Feb 2026 03:08:31 +0100 Subject: [PATCH 1/2] feat(map): add option to hide walls and rooms in map rendering --- roborock/map/map_parser.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/roborock/map/map_parser.py b/roborock/map/map_parser.py index 5bab061f..9154ee1c 100644 --- a/roborock/map/map_parser.py +++ b/roborock/map/map_parser.py @@ -51,6 +51,12 @@ class MapParserConfig: show_background: bool = True """Whether to show the background of the map.""" + show_walls: bool = True + """Whether to show the walls of the map.""" + + show_rooms: bool = True + """Whether to show the rooms of the map.""" + map_scale: int = DEFAULT_MAP_SCALE """Scale factor for the map.""" @@ -94,11 +100,22 @@ def parse(self, map_bytes: bytes) -> ParsedMapData | None: def _create_map_data_parser(config: MapParserConfig) -> RoborockMapDataParser: """Create a RoborockMapDataParser based on the config entry.""" - colors = ColorsPalette() + color_dicts = {} + room_colors = {} + if not config.show_background: - colors = ColorsPalette({SupportedColor.MAP_OUTSIDE: (0, 0, 0, 0)}) + color_dicts[SupportedColor.MAP_OUTSIDE] = (0, 0, 0, 0) + + if not config.show_walls: + color_dicts[SupportedColor.GREY_WALL] = (0, 0, 0, 0) + color_dicts[SupportedColor.MAP_WALL] = (0, 0, 0, 0) + color_dicts[SupportedColor.MAP_WALL_V2] = (0, 0, 0, 0) + + if not config.show_rooms: + room_colors = {str(x): (0, 0, 0, 0) for x in range(1, 32)} + return RoborockMapDataParser( - colors, + ColorsPalette(color_dicts if len(color_dicts) else None, room_colors if len(room_colors) else None), Sizes({k: v * config.map_scale for k, v in Sizes.SIZES.items() if k != Size.MOP_PATH_WIDTH}), config.drawables, ImageConfig(scale=config.map_scale), From 987e51e79bda25f1b988a6e21d3d330b285fd738 Mon Sep 17 00:00:00 2001 From: johnmph Date: Mon, 2 Feb 2026 03:51:54 +0100 Subject: [PATCH 2/2] fix(map): removed unnecessary conversion of empty dict to none --- roborock/map/map_parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roborock/map/map_parser.py b/roborock/map/map_parser.py index 9154ee1c..44924a8a 100644 --- a/roborock/map/map_parser.py +++ b/roborock/map/map_parser.py @@ -115,7 +115,7 @@ def _create_map_data_parser(config: MapParserConfig) -> RoborockMapDataParser: room_colors = {str(x): (0, 0, 0, 0) for x in range(1, 32)} return RoborockMapDataParser( - ColorsPalette(color_dicts if len(color_dicts) else None, room_colors if len(room_colors) else None), + ColorsPalette(color_dicts, room_colors), Sizes({k: v * config.map_scale for k, v in Sizes.SIZES.items() if k != Size.MOP_PATH_WIDTH}), config.drawables, ImageConfig(scale=config.map_scale),