Vacuum Interactive Map Card

After some fun with yaml and jinja I have created a script that bypasses 5 zones limit and doesn’t return to base after each zone. You can check it out in my repo: vacuum_send_command_multiple_zones.yaml

Usage:

type: custom:xiaomi-vacuum-map-card
entity: vacuum.xiaomi_vacuum
map_image: '/local/custom_lovelace/xiaomi_vacuum_map_card/map.png'
ignore_zones_limit: true
service: script.vacuum_send_command_multiple_zones
calibration_points:
  - vacuum:
      x: 25500
      y: 25500
    map:
      x: 466
      y: 1889
  - vacuum:
      x: 26500
      y: 26500
    map:
      x: 730
      y: 1625
  - vacuum:
      x: 25500
      y: 26500
    map:
      x: 466
      y: 1625
zones:
  - [[25500, 25500, 26500, 26500]]

@3_14: Great! I did a quick test of your scripts, and it seemed to be working great with more than five zones. My roborock seemed to have a small lag and started returning to dock before pausing, but that might just be the way it is with wifi delays and such?

Unfortunately it is not possible to avoid lag, the script has to wait for vacuum to finish zoned cleanup (so effectively start to return to base) and this change is not reported immediately

Yeah, thought that might be the case. No worries. Do you know if it is possible somehow to mute the voice message “Going back to dock”?

Another thing: When I apply “ignore_zones_limit: true” it seems I am unable to select my pre-defined zones. Not sure if it is something I do wrong, but as soon as I set it false, I can select the zones as before. The manual zone-marking seems to be ok. Can you check if it is the same on your side?

I don’t know if it is possible to set volume from HA, service vacuum.send_command is not documented at all :frowning:

Whooops, my bad, it should be fixed right now :wink:

1 Like

Working at speed of light man :slight_smile: Thanks, working well now.

2 Likes

I didnt test it yet, but it looks VERY promising.

I just have a few whishes, that might be usable for the most users.

Might it be possible to have something like a “hidden map” where you set the zones like in your animations and link the zones to a second map, where you just actually select the rooms?

The reason for that is, that most users will probably select rooms to be cleaned rather then zones.
If this would be possible, that users can set a vaccum map and a moping map, where everyone could exclude carpets etc.
This would be the best and most usable implementation and an big advantage over the “out of the box” posibilitys.

Maybe someone has an idea if and how this is possible an a user friendly way.

Last thing: Might it be possible to let the robot clean in the sequence as selected?
This way you can select the kitchen to be cleaned at first, after that you can go cooking and dont get interrupt by the robot, while it cleans the rest.

That would be awesome.

Im still a bloody beginner and could not even make the floorplan working - but if my wishes above are possible than I will try harder to make it work :smiley:
Thanks a lot!

I think that the easiest solution for your first idea would be to create two separate cards (first one for regular cleaning, second one for mopping) and show only one of them using a Conditional Card depending on mode of a vacuum.

Your second idea is already implemented :wink:

Thanks for your answer @3_14.
In the meantime I did it as you recommended it :wink: (had the same idea).

One problem is the “calibration” is somwhow inaccurate.

.

I did use the scanned map from my robot and took that as template for my room plan.
So it should line up perfectly but it isnt.

For calibration I took 3 points in a triangle with the “go to” function of FloleVac and took a screenshot.
I measured the coordinates with photoshop zommed in to pixel view but the zones were far off.

So I modified them by hand untill they almost matched:
Left side: normal vacuum plan, right side for moping (with 10 zones needed).
For the moping map, I placed the zones clockwise.

Its on the first moping run right now, but after it was done bottom left it went again bottom right…
it is there now since 15min and looks like its lost…

Weird is, that I cant locate the robot right now via the xiaomi app, nor via FloleVac.

But other than that I was able to install it and its working… somehow :smiley:
Good job and thanks a lot!

Hopefully I (we, someone) can figure out, what the problem is…

Can you enable debug mode (by adding debug: true in cards configuration) and send another screenshot?

Any chance of a port for Neato botvacs?

Probably this card already supports it (after some tweaks). Could you describe how zoned cleanup works in Neatos case?

Great work! Thank you very much. (Dziękuję bardzo.)
How can I change the color of the zone?

It is not possible in current version, but I will try to add possibility to change colors in future version :slight_smile:

I dont know if Neato can support this yet because we don’t support creating maps and no go lines from the API. All we do is clean already specified areas from the Neato app. There would need to be some code changes to get this to work properly and even then I am not sure how easy it would be.

https://developers.neatorobotics.com/api/robot-remote-protocol/maps

I have looked at Neatos API recently and I think that the only way I can provide a support for Neato vacuums would be to create a separate card that would get information about zones already defined in an official app and display them just like in “Predefined zones” mode. Unfortunately I don’t know what kind of data HA gets from API, so my ideas are highly theoretical.

1 Like

Feel free to ask me questions about the Neato API and the HA implementation :slight_smile: As of now in the linked docs are pulling in the presistent map data (see getMapBoundaries). For zone cleaning Iwe are actually taking the zone name and looking at the json output and cleaning based on the name. The regions should be supplied by the API so I think we can try to leverage that.

1 Like

It appears that method getMapBoundaries returns all data that my card would need to draw zones (in boundaries section), but as far as I see (correct me if I’m wrong) HA doesn’t provide this information as entity parameters. Probably it is not hard to add reading map data in HA, I would probably even do this myself if I had Neato vacuum, but without it I cannot test it :frowning:

1 Like

Does Xiaomi show those as attributes for the entity? I dont have one to test with. We can update Neato to provide that info and mimic Xiaomi.

Edit: it looks like users just need to grab this data and provide it to the card? how do they get that info today? they can always interact with the parent library to grab this data just like we use it in HA.

Currently zones have to be provided by a user, because (most of) Xiaomi Vacuums don’t have possibility to save them in app. Coordinates for zones can be retrieved using unofficial app for vacuum (FloleVac) or card itself (in debug mode).
Additionally map has to be calibrated before usage. It can be done using FloleVac or by calling HA service.

In case of Neato it is possible to get all required data from API itself, so it would be nice to use this possibility. A list of boundaries (exactly the same like in Neato API) combined with Neato camera should be enough for a dedicated card to provide a user-friendly solution for zoned cleaning.

1 Like