From 76641831cc5796f7e486af73c222d8aad8870544 Mon Sep 17 00:00:00 2001 From: SCA075 <82227818+sca075@users.noreply.github.com> Date: Sun, 15 Mar 2026 20:17:45 +0100 Subject: [PATCH] fix(conga): fix calibration and room coordinates scaling - bump to 0.3.2 (#77) - Override get_vacuum_points to divide crop_area by CONGA_SCALE, restoring calibration points to original vacuum coordinate space. - Override async_get_rooms_attributes to divide room outline and centre x/y by CONGA_SCALE, restoring room data to vacuum space. - Bump version to 0.3.2. --- SCR/valetudo_map_parser/__init__.py | 2 +- SCR/valetudo_map_parser/conga_handler.py | 17 +++++++++++++++++ pyproject.toml | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) 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"