From 8d62f4b534cfd59dba274a00ecf6967a933a4e2d Mon Sep 17 00:00:00 2001 From: ia74 <68617740+ia74@users.noreply.github.com> Date: Fri, 25 Jul 2025 08:40:19 -0500 Subject: [PATCH] Dynamic icon --- custom_components/roomba_rest980/camera.py | 14 +++++++++++--- custom_components/roomba_rest980/manifest.json | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/custom_components/roomba_rest980/camera.py b/custom_components/roomba_rest980/camera.py index 48cf5f6..09330c5 100644 --- a/custom_components/roomba_rest980/camera.py +++ b/custom_components/roomba_rest980/camera.py @@ -11,7 +11,7 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback -from .const import DOMAIN +from .const import DOMAIN, regionTypeMappings _LOGGER = logging.getLogger(__name__) @@ -622,7 +622,9 @@ class RoombaMapCamera(Camera): if coord: # Transform coordinate to map image space img_x = coord[0] * scale + offset_x - img_y = MAP_HEIGHT - (coord[1] * scale + offset_y) # Flip Y axis + img_y = MAP_HEIGHT - ( + coord[1] * scale + offset_y + ) # Flip Y axis polygon_coords.append([int(img_x), int(img_y)]) if len(polygon_coords) >= 3: @@ -635,10 +637,16 @@ class RoombaMapCamera(Camera): center_x = int(x_sum / len(room_outline)) center_y = int(y_sum / len(room_outline)) + # Get the appropriate icon based on region type + region_type = region.get("region_type", "default") + icon = regionTypeMappings.get( + region_type, regionTypeMappings.get("default") + ) + # Create room configuration similar to the vacuum card format rooms_dict[room_id] = { "name": room_name, - "icon": "mdi:broom", + "icon": icon, "x": center_x, "y": center_y, "outline": room_outline, diff --git a/custom_components/roomba_rest980/manifest.json b/custom_components/roomba_rest980/manifest.json index 089d5b8..a2badec 100644 --- a/custom_components/roomba_rest980/manifest.json +++ b/custom_components/roomba_rest980/manifest.json @@ -4,7 +4,7 @@ "codeowners": [ "@ia74" ], - "version": "1.7.0", + "version": "1.7.1", "config_flow": true, "dependencies": [], "dhcp": [