Improve roborock map image (#140379)

This commit is contained in:
Allen Porter 2025-03-11 07:12:19 -07:00 committed by GitHub
parent 6c54f8dff2
commit ca33d7263f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -49,6 +49,7 @@ IMAGE_CACHE_INTERVAL = 90
MAP_SLEEP = 3
GET_MAPS_SERVICE_NAME = "get_maps"
MAP_SCALE = 4
MAP_FILE_FORMAT = "PNG"
MAP_FILENAME_SUFFIX = ".png"
SET_VACUUM_GOTO_POSITION_SERVICE_NAME = "set_vacuum_goto_position"

View File

@ -26,6 +26,7 @@ from .const import (
DRAWABLES,
IMAGE_CACHE_INTERVAL,
MAP_FILE_FORMAT,
MAP_SCALE,
MAP_SLEEP,
)
from .coordinator import RoborockConfigEntry, RoborockDataUpdateCoordinator
@ -47,7 +48,11 @@ async def async_setup_entry(
if config_entry.options.get(DRAWABLES, {}).get(drawable, default_value)
]
parser = RoborockMapDataParser(
ColorsPalette(), Sizes(), drawables, ImageConfig(), []
ColorsPalette(),
Sizes({k: v * MAP_SCALE for k, v in Sizes.SIZES.items()}),
drawables,
ImageConfig(scale=MAP_SCALE),
[],
)
def parse_image(map_bytes: bytes) -> bytes | None: