From 2b5bd0e31753b22479a8253e4b24da94022d76ff Mon Sep 17 00:00:00 2001 From: SCA075 <82227818+sca075@users.noreply.github.com> Date: Thu, 23 Oct 2025 17:44:56 +0200 Subject: [PATCH 01/10] adding const.py and update types.py to separate const and types Signed-off-by: Sandro Cantarella --- SCR/valetudo_map_parser/hypfer_handler.py | 1 + 1 file changed, 1 insertion(+) diff --git a/SCR/valetudo_map_parser/hypfer_handler.py b/SCR/valetudo_map_parser/hypfer_handler.py index a125d4a..69b1383 100644 --- a/SCR/valetudo_map_parser/hypfer_handler.py +++ b/SCR/valetudo_map_parser/hypfer_handler.py @@ -16,6 +16,7 @@ from .config.async_utils import AsyncPIL from .config.drawable_elements import DrawableElement from .config.shared import CameraShared +from .const import COLORS from .config.types import ( LOGGER, CalibrationPoints, From c6ab4ee95be9efcf6b2dd3fdf129c43cdb997cbb Mon Sep 17 00:00:00 2001 From: SCA075 <82227818+sca075@users.noreply.github.com> Date: Tue, 4 Nov 2025 18:06:54 +0100 Subject: [PATCH 02/10] last files for 12 isort / ruff and lint Signed-off-by: Sandro Cantarella --- SCR/valetudo_map_parser/hypfer_handler.py | 1 - SCR/valetudo_map_parser/rand256_handler.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/SCR/valetudo_map_parser/hypfer_handler.py b/SCR/valetudo_map_parser/hypfer_handler.py index 69b1383..a125d4a 100644 --- a/SCR/valetudo_map_parser/hypfer_handler.py +++ b/SCR/valetudo_map_parser/hypfer_handler.py @@ -16,7 +16,6 @@ from .config.async_utils import AsyncPIL from .config.drawable_elements import DrawableElement from .config.shared import CameraShared -from .const import COLORS from .config.types import ( LOGGER, CalibrationPoints, diff --git a/SCR/valetudo_map_parser/rand256_handler.py b/SCR/valetudo_map_parser/rand256_handler.py index 3ed2a74..8e150e8 100644 --- a/SCR/valetudo_map_parser/rand256_handler.py +++ b/SCR/valetudo_map_parser/rand256_handler.py @@ -15,7 +15,6 @@ from .config.async_utils import AsyncPIL from .config.drawable_elements import DrawableElement -from .const import COLORS, DEFAULT_IMAGE_SIZE, DEFAULT_PIXEL_SIZE from .config.types import ( LOGGER, Colors, @@ -31,6 +30,7 @@ initialize_drawing_config, point_in_polygon, ) +from .const import COLORS, DEFAULT_IMAGE_SIZE, DEFAULT_PIXEL_SIZE from .map_data import RandImageData from .reimg_draw import ImageDraw from .rooms_handler import RandRoomsHandler From e6b006c8ffb6768475f7050f6a9a24e6c500f454 Mon Sep 17 00:00:00 2001 From: SCA075 <82227818+sca075@users.noreply.github.com> Date: Fri, 19 Dec 2025 08:07:11 +0100 Subject: [PATCH 03/10] remove duplicate import of const Signed-off-by: Sandro Cantarella --- SCR/valetudo_map_parser/rand256_handler.py | 1 - 1 file changed, 1 deletion(-) diff --git a/SCR/valetudo_map_parser/rand256_handler.py b/SCR/valetudo_map_parser/rand256_handler.py index 8e150e8..d1df01c 100644 --- a/SCR/valetudo_map_parser/rand256_handler.py +++ b/SCR/valetudo_map_parser/rand256_handler.py @@ -30,7 +30,6 @@ initialize_drawing_config, point_in_polygon, ) -from .const import COLORS, DEFAULT_IMAGE_SIZE, DEFAULT_PIXEL_SIZE from .map_data import RandImageData from .reimg_draw import ImageDraw from .rooms_handler import RandRoomsHandler From a5ca57172820a8526d0b04f8342001e7621919e9 Mon Sep 17 00:00:00 2001 From: SCA075 <82227818+sca075@users.noreply.github.com> Date: Sat, 20 Dec 2025 13:59:48 +0100 Subject: [PATCH 04/10] const was not properly imported Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com> --- SCR/valetudo_map_parser/rand256_handler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SCR/valetudo_map_parser/rand256_handler.py b/SCR/valetudo_map_parser/rand256_handler.py index d1df01c..8a68f09 100644 --- a/SCR/valetudo_map_parser/rand256_handler.py +++ b/SCR/valetudo_map_parser/rand256_handler.py @@ -15,6 +15,7 @@ from .config.async_utils import AsyncPIL from .config.drawable_elements import DrawableElement +from .const import COLORS, DEFAULT_IMAGE_SIZE, DEFAULT_PIXEL_SIZE from .config.types import ( LOGGER, Colors, @@ -542,4 +543,4 @@ def get_calibration_data(self, rotation_angle: int = 0) -> Any: calibration_point = {"vacuum": vacuum_point, "map": map_point} self.calibration_data.append(calibration_point) - return self.calibration_data + return self.calibration_data \ No newline at end of file From 0d4f63c615dbe43bd0c2fd80ac26f29fbecf4bca Mon Sep 17 00:00:00 2001 From: SCA075 <82227818+sca075@users.noreply.github.com> Date: Sat, 20 Dec 2025 17:17:49 +0100 Subject: [PATCH 05/10] minor changes in rand256_handler.py, shared.py removed snapshot at init bump version in pyproject.toml added to __init__.py Trims and Floor Data Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com> --- SCR/valetudo_map_parser/__init__.py | 4 +++- SCR/valetudo_map_parser/config/shared.py | 4 ---- SCR/valetudo_map_parser/rand256_handler.py | 2 +- pyproject.toml | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/SCR/valetudo_map_parser/__init__.py b/SCR/valetudo_map_parser/__init__.py index 37d3cd3..0d72b66 100644 --- a/SCR/valetudo_map_parser/__init__.py +++ b/SCR/valetudo_map_parser/__init__.py @@ -1,5 +1,5 @@ """Valetudo map parser. -Version: 0.1.13""" +Version: 0.1.14""" from pathlib import Path @@ -12,6 +12,7 @@ from .config.status_text.translations import translations as STATUS_TEXT_TRANSLATIONS from .config.types import ( CameraModes, + FloorData, ImageSize, JsonType, NumpyArray, @@ -20,6 +21,7 @@ RoomStore, SnapshotStore, TrimCropData, + TrimsData, UserLanguageStore, ) from .config.utils import ResizeParams, async_resize_image diff --git a/SCR/valetudo_map_parser/config/shared.py b/SCR/valetudo_map_parser/config/shared.py index 77443c5..b2257bd 100755 --- a/SCR/valetudo_map_parser/config/shared.py +++ b/SCR/valetudo_map_parser/config/shared.py @@ -311,10 +311,6 @@ def update_shared_data(self, device_info): instance.vacuum_status_position = device_info.get( CONF_VAC_STAT_POS, DEFAULT_VALUES["vac_status_position"] ) - # If enable_snapshots, check for png in www. - instance.enable_snapshots = device_info.get( - CONF_SNAPSHOTS_ENABLE, DEFAULT_VALUES["enable_www_snapshots"] - ) # Ensure trims are updated correctly trim_data = device_info.get("trims_data", DEFAULT_VALUES["trims_data"]) instance.trims = TrimsData.from_dict(trim_data) diff --git a/SCR/valetudo_map_parser/rand256_handler.py b/SCR/valetudo_map_parser/rand256_handler.py index 8a68f09..3ed2a74 100644 --- a/SCR/valetudo_map_parser/rand256_handler.py +++ b/SCR/valetudo_map_parser/rand256_handler.py @@ -543,4 +543,4 @@ def get_calibration_data(self, rotation_angle: int = 0) -> Any: calibration_point = {"vacuum": vacuum_point, "map": map_point} self.calibration_data.append(calibration_point) - return self.calibration_data \ No newline at end of file + return self.calibration_data diff --git a/pyproject.toml b/pyproject.toml index ecf107d..e2cb060 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "valetudo-map-parser" -version = "0.1.13" +version = "0.1.14" description = "A Python library to parse Valetudo map data returning a PIL Image object." authors = ["Sandro Cantarella "] license = "Apache-2.0" From c412fd7fb0f2dd8c9dbdcb20101e0c65a02e1fa8 Mon Sep 17 00:00:00 2001 From: SCA075 <82227818+sca075@users.noreply.github.com> Date: Sun, 21 Dec 2025 09:29:15 +0100 Subject: [PATCH 06/10] updated __init__.py Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com> --- SCR/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SCR/__init__.py b/SCR/__init__.py index 2217ee2..ebdf05f 100644 --- a/SCR/__init__.py +++ b/SCR/__init__.py @@ -1,2 +1,2 @@ """Valetudo map parser. -Version: 0.1.10""" +Version: 0.1.14""" From 11c09e24c037e90e4d0e355195d2add3f0c70585 Mon Sep 17 00:00:00 2001 From: SCA075 <82227818+sca075@users.noreply.github.com> Date: Sun, 21 Dec 2025 09:33:41 +0100 Subject: [PATCH 07/10] updated __init__.py all Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com> --- SCR/valetudo_map_parser/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SCR/valetudo_map_parser/__init__.py b/SCR/valetudo_map_parser/__init__.py index 0d72b66..b0816d7 100644 --- a/SCR/valetudo_map_parser/__init__.py +++ b/SCR/valetudo_map_parser/__init__.py @@ -150,6 +150,7 @@ def get_default_font_path() -> str: "SENSOR_NO_DATA", # Classes and Handlers "CameraShared", + "FloorData", "CameraSharedManager", "ColorsManagement", "Drawable", @@ -172,6 +173,7 @@ def get_default_font_path() -> str: "RoomStore", "SnapshotStore", "TrimCropData", + "TrimsData", "UserLanguageStore", # Utilities "ResizeParams", From cb056f43243e8bd34480f0ac09a2e8fc36879852 Mon Sep 17 00:00:00 2001 From: SCA075 <82227818+sca075@users.noreply.github.com> Date: Sun, 21 Dec 2025 11:02:18 +0100 Subject: [PATCH 08/10] updated __init__.py all Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com> --- SCR/valetudo_map_parser/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SCR/valetudo_map_parser/__init__.py b/SCR/valetudo_map_parser/__init__.py index b0816d7..7fb2898 100644 --- a/SCR/valetudo_map_parser/__init__.py +++ b/SCR/valetudo_map_parser/__init__.py @@ -150,7 +150,6 @@ def get_default_font_path() -> str: "SENSOR_NO_DATA", # Classes and Handlers "CameraShared", - "FloorData", "CameraSharedManager", "ColorsManagement", "Drawable", @@ -165,6 +164,7 @@ def get_default_font_path() -> str: "StatusText", # Types "CameraModes", + "FloorData", "ImageSize", "JsonType", "NumpyArray", From 4e216569dbd2cb808f65623ba4e630cf3c393443 Mon Sep 17 00:00:00 2001 From: SCA075 <82227818+sca075@users.noreply.github.com> Date: Wed, 24 Dec 2025 07:32:01 +0100 Subject: [PATCH 09/10] update shared.py to load floor data from the config if present else uses old key trims_data Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com> --- SCR/valetudo_map_parser/config/shared.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/SCR/valetudo_map_parser/config/shared.py b/SCR/valetudo_map_parser/config/shared.py index b2257bd..03ebc5c 100755 --- a/SCR/valetudo_map_parser/config/shared.py +++ b/SCR/valetudo_map_parser/config/shared.py @@ -311,9 +311,20 @@ def update_shared_data(self, device_info): instance.vacuum_status_position = device_info.get( CONF_VAC_STAT_POS, DEFAULT_VALUES["vac_status_position"] ) - # Ensure trims are updated correctly - trim_data = device_info.get("trims_data", DEFAULT_VALUES["trims_data"]) - instance.trims = TrimsData.from_dict(trim_data) + # Check for new floors_data first + floors_data = device_info.get("floors_data", None) + current_floor = device_info.get("current_floor", "floor_0") # Default fallback + + if floors_data: + # NEW: Use floors_data + floor_trims = floors_data.get(current_floor, DEFAULT_VALUES["trims_data"]) + instance.trims = TrimsData.from_dict(floor_trims) + instance.current_floor = current_floor + else: + # OLD: Backward compatibility + trim_data = device_info.get("trims_data", DEFAULT_VALUES["trims_data"]) + instance.trims = TrimsData.from_dict(trim_data) + instance.current_floor = "floor_0" # Default # Robot size robot_size = device_info.get("robot_size", 25) try: From 0505a8c88ca4e6845d78d950ab258619c10a4c8b Mon Sep 17 00:00:00 2001 From: SCA075 <82227818+sca075@users.noreply.github.com> Date: Thu, 8 Jan 2026 20:47:21 +0100 Subject: [PATCH 10/10] update TrimsCropData to use the floors when init, else default values. Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com> --- SCR/valetudo_map_parser/config/types.py | 10 +++++++--- SCR/valetudo_map_parser/config/utils.py | 4 +++- SCR/valetudo_map_parser/const.py | 2 +- pyproject.toml | 4 ++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/SCR/valetudo_map_parser/config/types.py b/SCR/valetudo_map_parser/config/types.py index 79fec70..e0bbc8f 100644 --- a/SCR/valetudo_map_parser/config/types.py +++ b/SCR/valetudo_map_parser/config/types.py @@ -63,7 +63,8 @@ class RoomProperty(TypedDict): @dataclass class TrimCropData: """Dataclass for trim and crop data.""" - + + floor: str trim_left: int trim_up: int trim_right: int @@ -72,6 +73,7 @@ class TrimCropData: def to_dict(self) -> dict: """Convert dataclass to dictionary.""" return { + "floor": self.floor, "trim_left": self.trim_left, "trim_up": self.trim_up, "trim_right": self.trim_right, @@ -82,6 +84,7 @@ def to_dict(self) -> dict: def from_dict(data: dict): """Create dataclass from dictionary.""" return TrimCropData( + floor=data["floor"], trim_left=data["trim_left"], trim_up=data["trim_up"], trim_right=data["trim_right"], @@ -93,9 +96,10 @@ def to_list(self) -> list: return [self.trim_left, self.trim_up, self.trim_right, self.trim_down] @staticmethod - def from_list(data: list): - """Create dataclass from list.""" + def from_list(data: list, floor: Optional[str] = "floor_0"): + """Create dataclass from list [trim_left, trim_up, trim_right, trim_down].""" return TrimCropData( + floor=floor, trim_left=data[0], trim_up=data[1], trim_right=data[2], diff --git a/SCR/valetudo_map_parser/config/utils.py b/SCR/valetudo_map_parser/config/utils.py index 74e93c3..2830a39 100644 --- a/SCR/valetudo_map_parser/config/utils.py +++ b/SCR/valetudo_map_parser/config/utils.py @@ -275,7 +275,9 @@ def prepare_resize_params( def update_trims(self) -> None: """Update the trims.""" - self.shared.trims = TrimsData.from_list(self.crop_area) + self.shared.trims = TrimsData.from_list( + self.crop_area, floor=self.shared.current_floor + ) def get_charger_position(self) -> ChargerPosition | None: """Return the charger position.""" diff --git a/SCR/valetudo_map_parser/const.py b/SCR/valetudo_map_parser/const.py index 2506135..1a47661 100644 --- a/SCR/valetudo_map_parser/const.py +++ b/SCR/valetudo_map_parser/const.py @@ -83,7 +83,7 @@ "vac_status_position": True, "get_svg_file": False, "save_trims": True, - "trims_data": {"trim_left": 0, "trim_up": 0, "trim_right": 0, "trim_down": 0}, + "trims_data": {"floor": "floor_0", "trim_left": 0, "trim_up": 0, "trim_right": 0, "trim_down": 0}, "enable_www_snapshots": False, "color_charger": [255, 128, 0], "color_move": [238, 247, 255], diff --git a/pyproject.toml b/pyproject.toml index e2cb060..5dc3f5a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "valetudo-map-parser" -version = "0.1.14" +version = "0.1.15" description = "A Python library to parse Valetudo map data returning a PIL Image object." authors = ["Sandro Cantarella "] license = "Apache-2.0" @@ -18,7 +18,7 @@ python = ">=3.13" numpy = ">=1.26.4" Pillow = ">=10.3.0" scipy = ">=1.12.0" -mvcrender = "==0.0.6" +mvcrender = "==0.0.7" [tool.poetry.group.dev.dependencies] ruff = "*"