Vacuum Interactive Map Card

Hi, how did you discover cordinates ?

well, I’ve started from the fact that 25500, 25500 was the docking station.
sent the roborock to 26000, 25500 then 25500, 26000 and so on…took screenshots and made a grid using the 5 screenshots.
It helped me to find out a scale, which helped me to find al the four corners of the rooms.

i also tryed in the past your solution but my vacuum gone crash across the wall :slight_smile:

Try baby steps!
25500, 25500 worked for me, as the coordinates of Docking statiton.

Try sending it to 25500, 26000
Do a screenshot
Send to 25500, 26500
Do a screenshot
26000, 25500
Screenshot
26500, 25500
Screenshot

Do a clean screenshot from your map in the end.
I’ve used Figma, and drew two lines (vertical, horizontal) to locate the vacuum cleaner on every screenshot.
Merged the lines, added a unique color, and made a note for the coordinates of every color. (blue 26500, 25500; red 25500, 26000, etc…)
then moved them to the clean screenshot, of the map.
Created a grid on the clean map, and you’ll have 4 coordinates and a grid.
This way you’ll have a sense how big is one 1x1 square on your grid, and you’ll be able to measure all the coordinates of the rooms using it.

This is how I succeeded.

The only thing I don’t know right know is what to do with these coordinates. :smiley:

@simcole @3_14 I’d appriciate some input :slight_smile:

Hi, awesome work, spent quite a lot of time reading through the whole thread but I am failing to find out whether it is possible to plot/overlay robot’s progress/path over a static (not returned by robot’s “camera”) image. Is it?

Hi, it is not possible yet, but I am working on it. For now you can check out this solution: Xiaomi Vacuum (rooted) live map with floor plan

WTF Bro :D:D:D … You made me laugh so hard :D:D… I gave up with this card, because I wasn’t able to calibrate the map good enough, and you managed this. But you describe the whole process with ease and end your post with “The only thing I don’t know right know is what to do with these coordinates” … Thanks for that :D:D

1 Like

I simply don’t understand.

Here is @simcole’s example:

calibration_points:
  - map:
      x: 817
      'y': 624
    vacuum:
      x: 25500
      'y': 26000
  - map:
      x: 817
      'y': 1088
    vacuum:
      x: 25500
      'y': 18000
  - map:
      x: 399
      'y': 1071
    vacuum:
      x: 18000
      'y': 18000
entity: vacuum.s5_vacuum
map_image: /community_plugin/lovelace-xiaomi-vacuum-map-card/map.png
type: 'custom:xiaomi-vacuum-map-card'
zones:
  - - - 12973
      - 22562
      - 28773
      - 27712
  - - - 14347
      - 8112
      - 23397
      - 22612
  - - - 23406
      - 12086
      - 29606
      - 22686
  - - - 14763
      - 8327
      - 29563
      - 22827

How should I insert my coordinates?
What are map x and ‘y’ or vacuum x and ‘y’?
In which order should I add zones?

Important to note that X/Y from map start from lower left. My graphic program used upper left to identify coordinates. Took me a while to figure that out.

Actually it should be from upper left… Are you sure your vacuum coordinates are ok? Are they taken from Valetudo?

Strange. Works well here since I changed that. No valetudo. Plain firmware.

Fuck that. I’ve dropped the whole coordinates idea.
I’ve found app_segment_clean command. It uses the rooms, I already have in the Mi Home app.
It works great. Will write the logic, when I’ll have some time.

1 Like

So it turned out, you can use the rooms, Mi Home app already drew.
You only need to use app_segment_clean command.

The only thing I had to do is to find out, the ID of the rooms, I use in params: []
Since you can send the vacuum to multiple room, I suggest picking 1,2,3,4,5 in the first test.
If there are any match, you’ll see the room highlighted in the Mi Home app, like you were using room cleaning there.
If you see Spot cleanup in the top of the app, change the IDs.
If you see Room cleanup in the top of the app, and multiple rooms are colored then stop cleaning, start removing IDs in your list, and send the vacuum to clean again. This way you can find out which ID referred to which room.

In the end finding out the the coordinates weren’t that much useless, since I can send the vacuum next to the dumpster after 3 cleaning period. :slight_smile:

3 Likes

@szucs.krisz incredible find!

I was really struggling to set up proper coordinates, but with rooms it took me 5 minutes to figure out the whole home (and it’s really precise)

My last question is how do you set up using cards instead of launching with DEVTools - Service every time?
I followed this guide (LINK) and everything is working, but I have to clean 1 room at a time, there is no way to select multiple rooms at once

I’m still new to HA

Thanks

Hi everyone,
I have finally created a more detailed guide for map calibration. It is still not finished, but it might be already useful. The final version (with screenshots) should be available soon

4 Likes

Right now all I have is automations set up to room cleaning. That was my main goal.
Setting up cards, is the next challenge for me.
Right now I have almost nothing implemented in Lovelace, so I can’t help you about this.

hello 3_14,
Congratulation for the great project!

I am a newbie who is having hard time with calibration as when I press start on card the command is sent but nothing happens. Here is the map (screenshot from Flolevac)

I have follow your instructions and I have the rectangle coordinates and the coordinates of three corners as per steps 5 and 7. Here are all the sets of coordinates:

[[21092,11009,34942,28709]]

[23700,28150]
[30000,14200]
[22350,12000]

Don’t understand step 8.

Am still facing problem with the card as non of the modes are working.
Any help would be much appreciated.

type: 'custom:xiaomi-vacuum-map-card'
entity: vacuum.xiaomi_vacuum
map_image: /local/custom-lovelace/xiaomi_vacuum_map_card/map2.png
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:
        - [[31053, 24530, 34753, 27680]]
        - [[25736, 20330, 28236, 23930]]
        - [[21913, 17528, 24863, 19078]]

Hi @solomos,

The guide is not finished yet, it should be ready this weekend.
The goal of step 8 is to make yourself sure about coordinates of the zone created in step 3:
Corner near point [23700,28150] would be [21092,28709] and so on.
Example:

  1. You draw a zone and get black coordinates: [[x1,y1,x2,y2]]
  2. You mark points and get green coordinates: 3 times [x, y]
  3. You use black and green coordinates to get yellow ones
    • from x1 and x2 take one closer to x
    • from y1 and y2 take one closer to y

When you have these coordinates you have to find coordinates on the image (section “GIMP” in help)

Whats your Card config to show the time when the room was clean last?

vacuum_last_clean:
friendly_name: Last clean (days)
value_template: “{{ (( as_timestamp(now()) - as_timestamp(states.vacuum.xiaomi_vacuum_cleaner.attributes.clean_stop) ) / 86400 ) | round(0) }}”