Xiaomi Vacuum Interactive Map Card

Tags: #<Tag:0x00007f3f198e1480> #<Tag:0x00007f3f198e12f0>

Hi,

Recently I have created a custom card that enables you to control Xiaomi Vacuums by marking points/drawing zones on a map (just like in Mi Home). Additionally you can define zones in configuration and select which of them you wan to run.

Go to target:


Zoned cleanup:

Predefined zones:

25 Likes

Wow, nice work!
I have not yet tried this (on gen1 vacuum at the moment, so no persistant maps, but with a gen2 on the way), but I’m interested to know if it’s possible (now or in the future) to use a live map as the background?
This in combination with Xiaomi Vacuum (rooted) live map with floor plan would be amazing.

Unfortunately each time map changes you have to recalibrate map image, so lack of maps persistency in gen1 is a real issue.
I have seen live map feature, but I haven’t rooted my vacuum yet, it sits on my TODO list :wink:

I guess it depends on how often your card refresh the background image, but as long as the map is dumped to an image file, could it be used as background and refresh on change? Maybe a setting in the card config?
This would, as you said, not work with gen1 as the map is not persistant, but a gen2 could do the trick.

Oh, and you should absolutely root your vacuum, having the live map in Home Assistant is very convenient :slight_smile:

I am sure I will somehow figure it out when my vacuum will be rooted. Right now I have a lot of other things to do :wink:

issue is that the map orientation is not always the same.
Most of the time my vacuum will start in the same direction, but every so often it does not and the map is rotated.
That would make it difficult to use as background for something to be superimposed on top…

I like the predefined zones.

Oh, I thought the persiatant map-feature of gen2 (S50) helped with this. I haven’t tested this, so if the orientation varies I agree that it won’t work.

On gen2 (at least in my case) everything is working perfectly, map has never rotated by itself

Well, the map is done. So how can I define the reference point and base position?

You have to follow instructions from readme:

In my case I have first sent vacuum to both positions to have them marked on the map, then took screenshots and created map from them.

Thank you! But I lost the way. Are the reference points have to be defined on the created map in pixels if I understand correctly. But how can I do that? Wich software used for it? Where from are mesured the points?

Exactly. You can do it using for example Paint or Gimp. Most of image editors display coordinates of mouse in pixels. They are measured from upper left corner.

This is awesome [3_14])!
I’m completely new to HA. What should be the correct name for “entity:”? My vacuum is named “roborock.vacuum.s5” in configuration.yaml, but if I use “entity: xiaomi_roborock.vacuum.s5” I get error
Failed to call service vacuum/xiaomi_clean_zone. not a valid value for dictionary value @ data[‘entity_id’]
Thanks in advance.

Are you sure this is full id of your vacuum entity? You can check it in tab <HA_URL>/dev-state. It probably should be vacuum.roborock_vacuum_s5

Ok, I’m not sure what was the problem, the entity was corrrect, I checked on States as you directed. Then I restarted HA one more time just to be sure and now it works! :smiley:
Thanks your for help and the custom Card!

It would be nice to have an Stop/Return button next to Start.

I am happy that it is working :slight_smile:

Personally I use this card with much nicer looking picture-elements card, that has features you are talking about:

Thank you @3_14!

1 Like

Thank you so much. this card is fantastic. I recommend cutting the image with 1: 1 square pixel settings. It is very precise.
:+1:

1 Like

Great job :smiley: A few things:

Had to fine-tune the Base/Reference coordinates manually as using the Base/Ref coords from the image had the X axis way off. This was simple enough with trial-and-error, in just a few minutes everything was aligned perfectly. Not sure if this was because I did something wrong, is the image supposed to be a specific resolution? The X/Ys had to be adjusted by 10-30 each. Since it was an easy fix, it isn’t too important.

Suggestions:

  • As far as I know/tested Roborock S5 can only do up to 5 zones at a time. The App doesn’t let you add more, and if you do (via commands) the vacuum will go crazy when it starts cleaning zone 6: It goes back to the start and just drives around like crazy. I suggest limiting Zone/Preset selection to max 5 zones (or creating something that pauses the vacuum and starts the next 5 zones, if it’s done but not going for a recharge).

  • It seems like the preset zone order is random (at least not the order it was clicked in)? Being able to control the order is great (the first zone in the list is cleaned first). It would be great if the cleaning order was based on which preset zone you click first, second, etc…

1 Like