Setting up room cleaning with Map Extractor #317
Replies: 27 comments 83 replies
-
EDIT: Since v2.1.0 there is a simplified way to add rooms to your map card (see main post above). I recommend using it, as it is simple to use and I don't maintain the following code anymore. If you want the template to also generate an outline, you can use this: {# ----------------- PROVIDE YOUR OWN ENTITY IDS HERE ----------------- #}
{% set camera_entity = "camera.xiaomi_cloud_map_extractor" %}
{% set vacuum_entity = "vacuum.xiaomi_vacuum" %}
{# ------------------- DO NOT CHANGE ANYTHING BELOW ------------------- #}
{% set attributes = states[camera_entity].attributes %}
type: custom:xiaomi-vacuum-map-card
entity: {{ vacuum_entity }}
map_source:
camera: {{ camera_entity }}
calibration_source:
camera: true
map_modes:
- template: vacuum_goto
- template: vacuum_clean_zone
- template: vacuum_clean_segment
predefined_selections:
{%- for room_id in attributes.rooms | default([]) %}
{%- set room = attributes.rooms[room_id] %}
{%- set keep_float = "." in (room["x0"] | string) %}
{%- set x = ([room["x0"], room["x1"]] | sum / 2) if keep_float else (([room["x0"], room["x1"]] | sum / 2) | int) %}
{%- set y = ([room["y0"], room["y1"]] | sum / 2) if keep_float else (([room["y0"], room["y1"]] | sum / 2) | int) %}
- id: {{room_id}}
outline:
- - {{room["x0"]}}
- {{room["y0"]}}
- - {{room["x0"]}}
- {{room["y1"]}}
- - {{room["x1"]}}
- {{room["y1"]}}
- - {{room["x1"]}}
- {{room["y0"]}}
label:
text: Room {{room_id}}
x: {{ x }}
y: {{ y }}
offset_y: 35
icon:
name: "mdi:broom"
x: {{ x }}
y: {{ y }}
{%- endfor %} |
Beta Was this translation helpful? Give feedback.
-
Home Assistant Core 2022.5.5 |
Beta Was this translation helpful? Give feedback.
-
When trying to add the template, following error pops-up: TyperError: 'NoneType' object is not iterable.... This is the code {# ----------------- PROVIDE YOUR OWN ENTITY IDS HERE ----------------- #}
{% set camera_entity = "camera.xiaomi_cloud_map_extractor" %}
{% set vacuum_entity = "vacuum.jarvis" %}
{# ------------------- DO NOT CHANGE ANYTHING BELOW ------------------- #}
{% set attributes = states[camera_entity].attributes %}
type: custom:xiaomi-vacuum-map-card
entity: {{ vacuum_entity }}
map_source:
camera: {{ camera_entity }}
calibration_source:
camera: true
map_modes:
- template: vacuum_goto
- template: vacuum_clean_zone
- template: vacuum_clean_segment
predefined_selections:
{%- for room_id in attributes.rooms %}
{%- set room = attributes.rooms[room_id] %}
{%- set keep_float = "." in (room["x0"] | string) %}
{%- set x = ([room["x0"], room["x1"]] | sum / 2) if keep_float else (([room["x0"], room["x1"]] | sum / 2) | int) %}
{%- set y = ([room["y0"], room["y1"]] | sum / 2) if keep_float else (([room["y0"], room["y1"]] | sum / 2) | int) %}
- id: {{room_id}}
label:
text: Room {{room_id}}
x: {{ x }}
y: {{ y }}
offset_y: 35
icon:
name: "mdi:broom"
x: {{ x }}
y: {{ y }}
{%- endfor %} |
Beta Was this translation helpful? Give feedback.
-
What is the most convenient way to create segments (rooms) with a multi-floor setup? Should I change maps, by sending a command to my robot? Then combine the generated |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Quick sidenote to the new room config generator functionality: |
Beta Was this translation helpful? Give feedback.
-
When I was adding a template, an error also popped up: TyperError: 'NoneType' object is not iterable,what should i do? |
Beta Was this translation helpful? Give feedback.
-
Добрый день! Пётр, скажите, реализована ли возможность рисовать виртуальные стены на карте, чтобы робот не заезжал в определенные зоны? Аппарат rockrobo.vacuum.v1 |
Beta Was this translation helpful? Give feedback.
-
Well, i found how to define rooms, how to draw custom (not rectangle) outlines point by point in config file. But today robot started usuall regular cleaning and reset the map, and now new map coordinates is different and my room, drawled yesterday, is obsoletely not in a place. I am sure, here should be a solution, but i did not find it yet in discussions or FAQ. I think it should be some kind of map-saving option or it's coordinates option, or i have to put some calibration points to the config. My dock station (of course) is always in the same place. |
Beta Was this translation helpful? Give feedback.
-
what should i do, when i used the code below,and got this error. Is there something wrong ? `{# ----------------- PROVIDE YOUR OWN ENTITY IDS HERE ----------------- #} template: vacuum_goto |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Hello, |
Beta Was this translation helpful? Give feedback.
-
Hi Piotr, please, what have I done wrong? Please watch the following video. Physically, the vacuum cleaner pulls out of the docking station, stays there for about 10 seconds, and then immediately returns to it. However, when I start the vacuum cleaner in the "Zone cleanup" menu, everything works great. It does not work only cleaning the selected room, see video. Please help me find the my error. Untitled.video.-.Made.with.Clipchamp.2.mp4This is my configuration: language: cs
type: custom:xiaomi-vacuum-map-card
map_source:
camera: camera.xiaomi_cloud_map_extractor
calibration_source:
camera: true
entity: vacuum.roborock_s5_max
vacuum_platform: default
map_locked: false
two_finger_pan: true
map_modes:
- template: vacuum_clean_zone
- template: vacuum_clean_segment
predefined_selections:
- id: 1
outline:
- - 17263
- 27868
- - 19389
- 27868
- - 19389
- 23349
- - 17263
- 23349
label:
text: Koupelna
x: 18282
'y': 25796
offset_y: 35
icon:
name: mdi:shower
x: 18282
'y': 25496
- id: 2
outline:
- - 19607
- 27460
- - 22071
- 27460
- - 22071
- 23349
- - 19607
- 23349
label:
text: Kuchyň
x: 20800
'y': 25696
offset_y: 35
icon:
name: mdi:table-chair
x: 20800
'y': 25496
- id: 3
outline:
- - 22169
- 27771
- - 26156
- 27771
- - 26156
- 22310
- - 22169
- 22310
label:
text: Obývák
x: 24007
'y': 25700
offset_y: 35
icon:
name: mdi:television
x: 24007
'y': 25400
- id: 4
outline:
- - 18327
- 22165
- - 22145
- 22165
- - 22169
- 23397
- - 18327
- 23397
label:
text: Chodba
x: 20166
'y': 23396
offset_y: 35
icon:
name: mdi:shoe-print
x: 20166
'y': 22896
- id: 5
outline:
- - 22216
- 22189
- - 26130
- 22189
- - 26130
- 18226
- - 22216
- 18226
label:
text: Ložnice
x: 24166
'y': 20500
offset_y: 35
icon:
name: mdi:bed
x: 24166
'y': 20300
- id: 6
outline:
- - 18475
- 22050
- - 21164
- 22050
- - 21164
- 18249
- - 18475
- 18249
label:
text: Šatna podkroví
x: 20728
'y': 20420
offset_y: 35
icon:
name: mdi:wardrobe
x: 20728
'y': 20220
- id: 7
outline:
- - 26758
- 23180
- - 23738
- 23180
- - 23738
- 23832
- - 26758
- 23832
label:
text: Drobky
x: 24728
'y': 24620
offset_y: 35
icon:
name: mdi:broom
x: 26628
'y': 23520
- template: vacuum_goto
- template: vacuum_follow_path |
Beta Was this translation helpful? Give feedback.
-
Hi, Very new here and just learn to add the -rooms attribute to my code, very nice addition!
Thanks, |
Beta Was this translation helpful? Give feedback.
-
Great work on this Piotr. type: custom:xiaomi-vacuum-map-card
map_source:
camera: camera.xiaomi_cloud_map_extractor
calibration_source:
camera: true
entity: vacuum.roborock_vacuum_a27
vacuum_platform: default
map_modes:
- template: vacuum_clean_segment
name: Kamers Schoonmaken
max_repeats: 5
max_selections: 20
repeats_type: REPEAT
predefined_selections:
- id: '5'
label:
text: BadKamer
x: 37450
'y': 37650
outline:
- - 36050
- 36750
- - 38850
- 36750 Below is capped for just room definitions |
Beta Was this translation helpful? Give feedback.
-
Hey Piotr, first of all; its one of the best integrations / additions to HA ! What is the appropriate way and what is the most effeciant and easiest way to set up room cleaning ? Appreaciate your time ! |
Beta Was this translation helpful? Give feedback.
-
Hello, is this supposed to work with Neato? I can see the map, but cannot generate rooms config (the option is disabled). |
Beta Was this translation helpful? Give feedback.
-
Is it possible to generate rooms config when using the humbertogontijo/homeassistant-roborock custom component instead of your map extractor? |
Beta Was this translation helpful? Give feedback.
-
So I was able to get it to work, and this morning robotocks servers are super slow and won't load the map in the xiami or home assistant app. Got me wondering.
My line of thought is just eliminating the use of Xiaomi servers for maps... Maybe even if I could gain access to it and make it local, cut Xiaomi out entirely 😂. |
Beta Was this translation helpful? Give feedback.
-
Hi, I have a problem with zone and room cleaning. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I manage to install the integration you mentioned. When creating the vacuum map card in my dashboard, for 'Vacuum platform' default option did not work. Vacuum did not respond. I've selected the platform - KrzysztofHajdamowicz/miio2 , and know the vacuum starts to clean the specific room even though I receive every time the following error. Is the error something to take into consideration? Room cleaning seems to work fine.
On Thursday, August 10, 2023 at 12:12:12 PM GMT+3, Piotr Machowski ***@***.***> wrote:
Try this one instead:
https://github.com/KrzysztofHajdamowicz/home-assistant-vacuum-styj02ym
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Is it possible to create a custom button, per room on my UI, that will send the vacuum there? |
Beta Was this translation helpful? Give feedback.
-
Hi Piotr, @PiotrMachowski |
Beta Was this translation helpful? Give feedback.
-
Hi everyone, I followed the guide and I can finally manage the rooms from HA, I miss sending voice commands to my Google Home for the rooms. I see the camera.aspirapolvere entity, the status and the list of rooms: 1,2,3,4,5,6 |
Beta Was this translation helpful? Give feedback.
-
Hi, |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Hello, with the Xiaomi V1 vacuum cleaner model, despite the visible button to generate rooms, the generation does not take place. You can see the current cleaning map. I managed to achieve zone cleaning on a static configuration. Is it any different in practice from cleaning rooms? |
Beta Was this translation helpful? Give feedback.
-
Since v2.1.0 there is a simplified way to add rooms to your map card:
Add
rooms
toattributes
section of map extractor config and reload xiaomi_cloud_map_extractor domain using a dedicated button in Server Controls orxiaomi_cloud_map_extractor.reload
service callOpen card editor, click "Generate rooms config" button, check (adjust if needed) your config using yaml editor and save changes.
Remove
rooms
from map extractor's config to save memory and reload it againAdding rooms before v2.1.0
To easily set up room cleaning follow these steps:
rooms
toattributes
section of map extractor config and reload xiaomi_cloud_map_extractor domain using a dedicated button in Server Controls orxiaomi_cloud_map_extractor.reload
service callcamera_entity
andvacuum_entity
rooms
from map extractor's config to save memory and reload it againCoordinates provided in
outline
,icon
andlabel
are not used in vacuum communication - they are necessary for card just to draw map interface.Beta Was this translation helpful? Give feedback.
All reactions