Xiaomi Cloud Vacuum Map Extractor

Hi Piotr,

First of thanks for this amazing integration! I use the S5 Max an i had given up hope that i would be able to integrate it fully in my HA setup.

I have managed to follow your instructions and get it more or less fully operational. However, i have one issue i haven’t been able to solve. The map is extracted from the cloud and showing all features correctly except the path drawing. As you see there is a red line, this is always static and never updating while the robot is cleaning… Is this an issue with grabbing the map data?

I did try to remove the country setting but then it extracts nothing. While i did add my device in another european country it seems to extract using “de”.

I should point out that i can no longer connect to my device through Xiaomi Home App but i have connection in my HA and can control it from there.

I hope you can guide me to solve this, i’m new at HA so i might be missing something really obvious…

My configuration.yaml looks like this:

camera:
  - platform: xiaomi_cloud_map_extractor
    host: !secret roborock_host
    token: !secret roborock_token
    username: !secret roborock_username
    password: !secret roborock_password
    country: "de"
    draw:
      - charger
      - path
      - goto_path
      - predicted_path
      - no_go_zones
      - no_mopping_zones
      - vacuum_position
      - virtual_walls
      - zones
    colors:
     color_map_inside: [128, 128, 128]
     color_map_outside: [255, 255, 255, 0]
     color_map_wall: [100, 196, 254]
     color_map_wall_v2: [93, 109, 126]
     color_grey_wall: [93, 109, 126]
     color_path: [255, 0, 0]
     color_goto_path: [0, 255, 0]
     color_predicted_path: [255, 255, 0, 0]
     color_zones: [0xAD, 0xD8, 0xFF, 0x8F]
     color_zones_outline: [0xAD, 0xD8, 0xFF]
     color_virtual_walls: [255, 0, 0]
     color_no_go_zones: [255, 33, 55, 127]
     color_no_go_zones_outline: [255, 0, 0]
     color_no_mop_zones: [163, 130, 211, 127]
     color_no_mop_zones_outline: [163, 130, 211]
     color_charger: [0x66, 0xfe, 0xda, 0x7f]
     color_robo: [75, 235, 149]
     color_unknown: [0, 0, 0]
     color_scan: [0xDF, 0xDF, 0xDF]
    room_colors:
      1: [240, 178, 122]
      2: [133, 193, 233]
      3: [217, 136, 128]
      4: [52, 152, 219]
      5: [205, 97, 85]
      6: [243, 156, 18]
      7: [88, 214, 141]
      8: [245, 176, 65]
      9: [252, 212, 81]
      10: [72, 201, 176]
      11: [84, 153, 199]
      12: [133, 193, 233]
      13: [245, 176, 65]
      14: [82, 190, 128]
      15: [72, 201, 176]
      16: [165, 105, 18]
    map_transformation:
      scale: 2
      trim:
        top: 10
        bottom: 15
        left: 30
        right: 20   
    attributes:
      - calibration_points
      - charger
      - goto
      - goto_path
      - goto_predicted_path
      - image
      - is_empty
      - map_name
      - no_go_areas
      - no_mopping_areas
      - obstacles
      - path
      - room_numbers
      - rooms
      - vacuum_position
      - vacuum_room
      - walls
      - zones
    scan_interval:
      seconds: 10
    auto_update: true  

My vacuum popup card looks like this:

                    - type: picture-elements
                      title: Kartläggning
                      image: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 75 75' /%3E"
                      class: add_header
                      style: |
                        .card-header {
                          margin: -0.3em 0 0 0.75em;
                        }
                      elements:
                        - type: custom:xiaomi-vacuum-map-card
                          entity: vacuum.xiaomi_vacuum_cleaner
                          map_camera: camera.xiaomi_cloud_map_extractor
                          camera_calibration: true
                          style:                          
                            top: 50%
                            left: 47.5%
                            width: 60%

This integration uses data from Xiaomi Home, so if you don’t have this vacuum there then it won’t be able to update data

Thank you. Another addition I think would be beneficial is defined targets. I normally drive my vacuum to the garbage can when I empty my canister. Would be easier if I could just push a button.

Nice idea, but it is rather affects map card :slight_smile:

can these be ignored? i have lots of those in logs, someone elso too?

2020-11-03 11:41:10 WARNING (MainThread) [homeassistant.components.camera] Updating xiaomi_cloud_map_extractor camera took longer than the scheduled update interval 0:00:05
2020-11-03 13:04:31 WARNING (MainThread) [homeassistant.components.camera] Updating xiaomi_cloud_map_extractor camera took longer than the scheduled update interval 0:00:05

Yes, I have them too

They are caused by the map card, everybody who uses it with a camera will get it, there already is an issue raised.

thats a different error :slight_smile:

Whooooops… Sorry, my autoresponder has triggered :smiley:

You can disable warnings using this config or increase scan_interval in camera’s configuration.

ok, gonna change the scan interval

dont think i can ignore those messages with logger, i have other cameras too, if i have an issue then with the camera , i wont be able to see it

whats better, change it to 10 ?

You have to try by yourself, every case is different. The most time-consuming part is getting map id from a vacuum and sometimes vacuum doesn’t respond immediately.

Ok, trying now with 10 :slight_smile:

Hi, I am just wondering if this will work with the Roborock app? I have setup the Roborock custom component and have a token that is shorter than 32 characters.

Hello, and a big thank you!
I managed to display the map of my Roborock S6!
I have two questions :

  1. How to crop the image? I have a lot of blue around my card
  2. How to teach Home Assistant the zones? (To make a script and inject it into Alexa, to say “vacuum cleaner in the kitchen”)

Thank you !!!

@MrLemur
These are different tokens, the one with 32 characters can be used to communicate with a vacuum locally.

@Aurel_RV

  1. Check out trim configuration
  2. If you want to use zones defined in Xiaomi app you can add room_numbers in attributes configuration and use it in following service call:
service: vacuum.send_command
data:
  entity_id: vacuum.roborock
  command: app_segment_clean
  params: [1, 2, 4] #Here provide a list of room numbers you want to clean
1 Like

Thank you !!!
I tried :
entity_id: vacuum.wall_e
command: app_segment_clean
params: [1]

But room cleaning starts and stops 2 seconds later.

Well, you have to provide a correct room number :wink: everyone has different ones

Ah that makes sense, as the Roborock custom component is using Tuya API to connect. I’ll make the move over to the Xiaomi Home app instead.

Yes I understand.
Is this the part number or the name of the part?
I tried number 1 (kitchen) but it doesn’t work

It’s a number