diff --git a/SCR/valetudo_map_parser/__init__.py b/SCR/valetudo_map_parser/__init__.py index 3d5eba8..ccfe17c 100644 --- a/SCR/valetudo_map_parser/__init__.py +++ b/SCR/valetudo_map_parser/__init__.py @@ -1,5 +1,5 @@ """Valetudo map parser. -Version: 0.3.1""" +Version: 0.3.2""" from pathlib import Path diff --git a/SCR/valetudo_map_parser/conga_handler.py b/SCR/valetudo_map_parser/conga_handler.py index 4fc0cbe..e27ea4f 100644 --- a/SCR/valetudo_map_parser/conga_handler.py +++ b/SCR/valetudo_map_parser/conga_handler.py @@ -56,6 +56,23 @@ def _scale_conga_json(m_json: JsonType, scale: int) -> JsonType: entity["points"] = [v * scale for v in pts] return scaled + async def async_get_rooms_attributes(self): + """Get room attributes with outline and centre coordinates divided back by CONGA_SCALE. + + The parent extracts outlines from the pre-scaled JSON, so every coordinate is + multiplied by CONGA_SCALE. Dividing here restores the original vacuum space. + """ + rooms = await super().async_get_rooms_attributes() + if not rooms: + return rooms + for room_data in rooms.values(): + room_data["outline"] = [ + (x // CONGA_SCALE, y // CONGA_SCALE) for x, y in room_data["outline"] + ] + room_data["x"] = room_data["x"] // CONGA_SCALE + room_data["y"] = room_data["y"] // CONGA_SCALE + return rooms + async def async_get_conga_from_json( self, m_json: JsonType | None ) -> Image.Image | None: diff --git a/pyproject.toml b/pyproject.toml index c33d8ac..973fe9b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "valetudo-map-parser" -version = "0.3.1" +version = "0.3.2" description = "A Python library to parse Valetudo map data returning a PIL Image object." authors = ["Sandro Cantarella "] license = "Apache-2.0"