Conversation
Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>
Signed-off-by: Sandro Cantarella <sandro@79f3d049-9006-400d-9954-2e5dcd250fa9.fritz.box>
Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
…it bump version in pyproject.toml added to __init__.py Trims and Floor Data Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
…ses old key trims_data Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
- Add CARPET drawable element with configurable color and alpha - Implement carpet zone parsing from Valetudo JSON (PolygonMapEntity) - Add carpet rendering with customizable color (default: 50% of room_0) - Support disable_carpets flag to toggle carpet visibility - Fix COLORS list order to match base_color_keys mapping - Fix floor rendering to use correct MAP_BACKGROUND color - Add carpet color configuration to device_info Fixes color index mismatch that affected carpet and floor color updates Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
from_list Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Fixes carpet color/alpha from device_info not being applied due to missing DrawableElement.CARPET entry in update_from_device_info(). Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
…tial implementation attempt and is not needed since we're using the simpler approach of passing color_carpet directly from device_info to the zones() drawing method. Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds carpet and per-segment material support: new color/constants for carpet/wood/tile, a MaterialTileRenderer to generate textures, propagation of segment material metadata through map parsing, and drawing logic to composite material overlays and draw carpet zones. Changes
Sequence Diagram(s)sequenceDiagram
participant MapProcessor as MapProcessor (map_data)
participant ImageDraw as ImageDraw (hypfer_draw)
participant MaterialRenderer as MaterialTileRenderer (config/material)
participant ImageArray as Image Array (RGBA)
MapProcessor->>ImageDraw: pass materials_dict per segment
ImageDraw->>ImageDraw: for each segment, check MATERIAL_OVERLAY enabled & material present
alt material overlay applicable
ImageDraw->>MaterialRenderer: get_tile(material, pixel_size, wood_rgba, tile_rgba)
MaterialRenderer-->>ImageDraw: return tile (cached)
ImageDraw->>MaterialRenderer: tile_block(tile, r0, r1, c0, c1)
MaterialRenderer-->>ImageDraw: return tile region
ImageDraw->>MaterialRenderer: apply_overlay_on_region(image, tile_region, r0, r1, c0, c1)
MaterialRenderer->>ImageArray: composite tile onto image using alpha
end
ImageDraw->>ImageDraw: draw carpet zones if enabled using color_carpet
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
SCR/valetudo_map_parser/const.py (1)
36-47: Critical: COLORS list order does not match SupportedColor enum order, breaking color rendering.The handlers map
COLORSby enumeration index touser_colors, butuser_colorsis built by iteratingSupportedColorin enum definition order. These orderings are completely different:
colors["wall"]maps touser_colors[0]which isCHARGERcolor (notWALLS)colors["zone_clean"]maps touser_colors[1]which isPATHcolor (notZONE_CLEAN)- And so on for all 10 entries in
COLORSEvery rendered map element will display the wrong color. The
COLORSlist must be reordered to match theSupportedColorenum iteration order (excluding room colors), or the indexing logic in handlers must be updated to useSupportedColorkeys directly instead of positionalCOLORSenumeration.Note: Direct access to
user_colors[10]anduser_colors[11]inhypfer_draw.pyfor materials is correct and unaffected.SCR/valetudo_map_parser/map_data.py (1)
872-899:materialsfield missing fromupdate_from_dictallowed set.The
materialsfield was added toHyperMapDataand is handled infrom_dict, butupdate_from_dictdoesn't include it in theallowedset. This means partial updates won't be able to modify materials.🔧 Proposed fix
allowed = { "json_data", "json_id", "obstacles", "paths", "image_size", "areas", "pixel_size", "entity_dict", "layers", "active_zones", "virtual_walls", + "materials", }
🤖 Fix all issues with AI agents
In `@SCR/valetudo_map_parser/config/drawable_elements.py`:
- Around line 232-256: The property-update block in drawable_elements.py uses
mismatched dict keys so values never get set; inside the block that calls
DrawableElement.set_property (reference set_property and
DrawableElement.MATERIAL_OVERLAY), replace the incorrect lookups
device_info["alpha_material_wood"], device_info["color_material_tile"], and
device_info["alpha_material_tile"] with the matching keys used in the condition
checks: device_info["material_wood_alpha"], device_info["material_tile_color"],
and device_info["material_tile_alpha"] respectively so the
material_wood_alpha/material_tile_color/material_tile_alpha values are read and
applied correctly.
🧹 Nitpick comments (3)
SCR/valetudo_map_parser/config/colors.py (1)
137-152: Comments in color_array may be misleading.The comments for indices 8 and 9 (
color_predicted_pathandcolor_obstacle) don't seem to match the actual array values being referenced frombase_colors_array. Index 8 isbase_colors_array[8]which iscolor_charger, and index 9 isbase_colors_array[9]which iscolor_no_go.Suggestion: Fix misleading comments
color_array = [ base_colors_array[0], # color_wall base_colors_array[6], # color_no_go base_colors_array[7], # color_go_to - base_colors_array[8], # color_predicted_path - base_colors_array[9], # color_obstacle + base_colors_array[8], # color_charger + base_colors_array[9], # color_no_go color_black,SCR/valetudo_map_parser/config/material.py (1)
14-29: Unused singleton_material_colors.
MaterialColorsdataclass and_material_colorssingleton are defined but never referenced. The code directly usescolor_material_woodandcolor_material_tileimports instead.Consider removing the unused code or utilizing the singleton for consistency:
-@dataclass(frozen=True, slots=True) -class MaterialColors: - """Material colors for rendering.""" - - wood_rgba: Color = color_material_wood - tile_rgba: Color = color_material_tile - - -# Create a singleton instance for easy access -_material_colors = MaterialColors()SCR/valetudo_map_parser/hypfer_draw.py (1)
121-148: Replace magic indices with named constants for material colors.Hardcoded indices 10 and 11 are correct now, but this coupling to array positions in
user_colorsis fragile. Named constantsCOLOR_MATERIAL_WOODandCOLOR_MATERIAL_TILEare already defined inconst.pyand should be used for explicit lookup instead, making the code resilient to reordering ofbase_color_keysincolors.py.
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
SCR/valetudo_map_parser/config/colors.py (2)
10-69: Duplicate imports will cause a syntax error.
ALPHA_CARPETis imported twice (lines 12 and 14), andCOLOR_CARPETis imported twice (lines 41 and 43). This will cause Python to raise aSyntaxErrorat import time.🐛 Proposed fix to remove duplicate imports
from ..const import ( ALPHA_BACKGROUND, ALPHA_CARPET, ALPHA_CHARGER, - ALPHA_CARPET, ALPHA_GO_TO, ALPHA_MATERIAL_TILE, ALPHA_MATERIAL_WOOD, ALPHA_MOVE, ALPHA_NO_GO, ALPHA_ROBOT, ALPHA_ROOM_0, ALPHA_ROOM_1, ALPHA_ROOM_2, ALPHA_ROOM_3, ALPHA_ROOM_4, ALPHA_ROOM_5, ALPHA_ROOM_6, ALPHA_ROOM_7, ALPHA_ROOM_8, ALPHA_ROOM_9, ALPHA_ROOM_10, ALPHA_ROOM_11, ALPHA_ROOM_12, ALPHA_ROOM_13, ALPHA_ROOM_14, ALPHA_ROOM_15, ALPHA_TEXT, ALPHA_WALL, ALPHA_ZONE_CLEAN, COLOR_BACKGROUND, COLOR_CARPET, COLOR_CHARGER, - COLOR_CARPET, COLOR_GO_TO, COLOR_MATERIAL_TILE, COLOR_MATERIAL_WOOD,
139-154: Critical index mismatch incolor_arrayafter adding new colors tobase_colors_array.Adding
color_carpet,color_material_wood, andcolor_material_tileat indices 2-4 shifted all subsequent elements, but the indices incolor_arraywere not updated. The comments reveal the intended colors, but the actual indices now point to wrong colors:
Index Comment says Actually resolves to [6]color_no_go color_background [7]color_go_to color_move [8]color_predicted_path color_charger [9]color_obstacle color_no_go [2]color_robot color_carpet [5]color_charger color_robot [4]color_move color_material_tile [3]color_background color_material_wood 🐛 Proposed fix to correct indices based on comments
color_array = [ base_colors_array[0], # color_wall - base_colors_array[6], # color_no_go - base_colors_array[7], # color_go_to - base_colors_array[8], # color_predicted_path - base_colors_array[9], # color_obstacle + base_colors_array[9], # color_no_go + base_colors_array[10], # color_go_to + color_grey, # color_predicted_path (not in base_colors_array) + color_no_go, # color_obstacle (use direct reference) color_black, - base_colors_array[2], # color_robot - base_colors_array[5], # color_charger + base_colors_array[5], # color_robot + base_colors_array[8], # color_charger color_text, - base_colors_array[4], # color_move - base_colors_array[3], # color_background + base_colors_array[7], # color_move + base_colors_array[6], # color_background base_colors_array[1], # color_zone_clean color_transparent, rooms_color, ]Alternatively, consider using direct color variable references instead of array indices to avoid this fragility:
color_array = [ color_wall, color_no_go, color_go_to, # ... etc ]
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.