Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SCR/valetudo_map_parser/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Valetudo map parser.
Version: 0.3.1"""
Version: 0.3.2"""

from pathlib import Path

Expand Down
17 changes: 17 additions & 0 deletions SCR/valetudo_map_parser/conga_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <gsca075@gmail.com>"]
license = "Apache-2.0"
Expand Down