valetudo-map-parser 0.1.9a1__py3-none-any.whl → 0.1.9a2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -109,6 +109,45 @@ class CameraShared:
109
109
  self.skip_room_ids: List[str] = []
110
110
  self.device_info = None # Store the device_info
111
111
 
112
+ @staticmethod
113
+ def _compose_obstacle_links(vacuum_host_ip: str, obstacles: list) -> list | None:
114
+ """
115
+ Compose JSON with obstacle details including the image link.
116
+ """
117
+ obstacle_links = []
118
+ if not obstacles or not vacuum_host_ip:
119
+ return None
120
+
121
+ for obstacle in obstacles:
122
+ # Extract obstacle details
123
+ label = obstacle.get("label", "")
124
+ points = obstacle.get("points", {})
125
+ image_id = obstacle.get("id", "None")
126
+
127
+ if label and points and image_id and vacuum_host_ip:
128
+ # Append formatted obstacle data
129
+ if image_id != "None":
130
+ # Compose the link
131
+ image_link = (
132
+ f"http://{vacuum_host_ip}"
133
+ f"/api/v2/robot/capabilities/ObstacleImagesCapability/img/{image_id}"
134
+ )
135
+ obstacle_links.append(
136
+ {
137
+ "point": points,
138
+ "label": label,
139
+ "link": image_link,
140
+ }
141
+ )
142
+ else:
143
+ obstacle_links.append(
144
+ {
145
+ "point": points,
146
+ "label": label,
147
+ }
148
+ )
149
+ return obstacle_links
150
+
112
151
  def update_user_colors(self, user_colors):
113
152
  """Update the user colors."""
114
153
  self.user_colors = user_colors
@@ -149,7 +188,11 @@ class CameraShared:
149
188
  ATTR_VACUUM_JSON_ID: self.vac_json_id,
150
189
  ATTR_CALIBRATION_POINTS: self.attr_calibration_points,
151
190
  }
152
- if self.obstacles_data:
191
+ if self.obstacles_pos and self.vacuum_ips:
192
+ _LOGGER.debug("Generating obstacle links from: %s", self.obstacles_pos)
193
+ self.obstacles_data = self._compose_obstacle_links(
194
+ self.vacuum_ips, self.obstacles_pos
195
+ )
153
196
  attrs[ATTR_OBSTACLES] = self.obstacles_data
154
197
 
155
198
  if self.enable_snapshots:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: valetudo-map-parser
3
- Version: 0.1.9a1
3
+ Version: 0.1.9a2
4
4
  Summary: A Python library to parse Valetudo map data returning a PIL Image object.
5
5
  License: Apache-2.0
6
6
  Author: Sandro Cantarella
@@ -9,7 +9,7 @@ valetudo_map_parser/config/enhanced_drawable.py,sha256=QlGxlUMVgECUXPtFwIslyjubW
9
9
  valetudo_map_parser/config/optimized_element_map.py,sha256=52BCnkvVv9bre52LeVIfT8nhnEIpc0TuWTv1xcNu0Rk,15744
10
10
  valetudo_map_parser/config/rand25_parser.py,sha256=kIayyqVZBfQfAMkiArzqrrj9vqZB3pkgT0Y5ufrQmGA,16448
11
11
  valetudo_map_parser/config/room_outline.py,sha256=D20D-yeyKnlmVbW9lI7bsPtQGn2XkcWow6YNOEPnWVg,4800
12
- valetudo_map_parser/config/shared.py,sha256=Vr4bicL7aJoRQbwbXyjEpiWhfzZ-cakLlfRqL3LBhpM,10475
12
+ valetudo_map_parser/config/shared.py,sha256=Yd0MlAH6DaAfqxrUw1NW2uHxYoLe9IwKxyFowQ6VJWg,12133
13
13
  valetudo_map_parser/config/types.py,sha256=TaRKoo7G7WIUw7ljOz2Vn5oYzKaLyQH-7Eb8ZYql8Ls,17464
14
14
  valetudo_map_parser/config/utils.py,sha256=CFuuiS5IufEu9aeaZwi7xa1jEF1z6yDZB0mcyVX79Xo,29261
15
15
  valetudo_map_parser/hypfer_draw.py,sha256=L1eM8dDLNsi4SOUt9499v9jLbQa1MwDKPfMYHcUEsXQ,26722
@@ -20,8 +20,8 @@ valetudo_map_parser/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
20
20
  valetudo_map_parser/rand25_handler.py,sha256=EKf7dhBtLKt_lEFi3hiJwSL0wgX0ZmvWlNMPxS8TDQE,22875
21
21
  valetudo_map_parser/reimg_draw.py,sha256=1q8LkNTPHEA9Tsapc_JnVw51kpPYNhaBU-KmHkefCQY,12507
22
22
  valetudo_map_parser/rooms_handler.py,sha256=YP8OLotBH-RXluv398l7TTT2zIBHJp91b8THWxl3NdI,17794
23
- valetudo_map_parser-0.1.9a1.dist-info/LICENSE,sha256=Lh-qBbuRV0-jiCIBhfV7NgdwFxQFOXH3BKOzK865hRs,10480
24
- valetudo_map_parser-0.1.9a1.dist-info/METADATA,sha256=t_gesPLkbBaoePJ76pFabgH1A0lU58ZThIlEkcWtetE,3320
25
- valetudo_map_parser-0.1.9a1.dist-info/NOTICE.txt,sha256=5lTOuWiU9aiEnJ2go8sc7lTJ7ntMBx0g0GFnNrswCY4,2533
26
- valetudo_map_parser-0.1.9a1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
27
- valetudo_map_parser-0.1.9a1.dist-info/RECORD,,
23
+ valetudo_map_parser-0.1.9a2.dist-info/LICENSE,sha256=Lh-qBbuRV0-jiCIBhfV7NgdwFxQFOXH3BKOzK865hRs,10480
24
+ valetudo_map_parser-0.1.9a2.dist-info/METADATA,sha256=DZkyXziGLLJ2QK6P29Unz2P8tBWHVbJNUYe072gg5yU,3320
25
+ valetudo_map_parser-0.1.9a2.dist-info/NOTICE.txt,sha256=5lTOuWiU9aiEnJ2go8sc7lTJ7ntMBx0g0GFnNrswCY4,2533
26
+ valetudo_map_parser-0.1.9a2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
27
+ valetudo_map_parser-0.1.9a2.dist-info/RECORD,,