Xiaomi Cloud Vacuum Map Extractor

Sure, but it is not finished yet. Still work in progress.

Within configuration.yaml :

  camera:
    - platform: xiaomi_cloud_map_extractor
      host: !secret xiaomi_vacuum_host_unten
      token: !secret xiaomi_vacuum_token_unten
      username: !secret xiaomi_cloud_username
      password: !secret xiaomi_cloud_password
      country: "de"
      name: "Roborock unten"
      scan_interval: 10
      store_map_raw: true
      colors:
        color_map_inside: [32, 115, 185]
        color_map_outside: [19, 87, 148]
        color_map_wall: [100, 196, 254]
        color_map_wall_v2: [93, 109, 126]
        color_grey_wall: [93, 109, 126]
        color_path: [147, 194, 238]
        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]
      draw: ['all']
      attributes:
        - calibration_points
        - charger
        - cleaned_rooms
        - country
        - goto_path
        - goto_predicted_path
        - goto
        - ignored_obstacles_with_photo
        - ignored_obstacles
        - image
        - is_empty
        - map_name
        - no_go_areas
        - no_mopping_areas
        - obstacles_with_photo
        - obstacles
        - path
        - room_numbers
        - rooms
        - vacuum_position
        - vacuum_room_name
        - vacuum_room
        - walls
        - zones

Within Lovelace (raw) :

type: custom:xiaomi-vacuum-map-card
title: Roborock S5 Max (unten)
vacuum_platform: KrzysztofHajdamowicz/miio2
map_source:
  camera: camera.roborock_unten
calibration_source:
  camera: true
camera_calibration: true
entity: vacuum.roborock_s5_max_unten
map_modes:
  - template: vacuum_clean_zone
  - template: vacuum_goto
  - template: vacuum_clean_zone_predefined
    predefined_selections:
      - zones:
          - - 29126
            - 18301
            - 37050
            - 24630
        label:
          text: Diele Eingang
          x: 33500
          'y': 19800
        icon:
          name: mdi:home-import-outline
          x: 33500
          'y': 21000
      - zones:
          - - 25244
            - 22368
            - 29266
            - 28637
        label:
          text: Beanbag Zone
          x: 27300
          'y': 25000
        icon:
          name: mdi:sofa
          x: 27300
          'y': 26000
      - zones:
          - - 29126
            - 24685
            - 35069
            - 28647
        label:
          text: Esstisch
          x: 32500
          'y': 26000
        icon:
          name: mdi:table-chair
          x: 32500
          'y': 27000
      - zones:
          - - 35069
            - 25345
            - 38096
            - 28647
        label:
          text: Pantry
          x: 36650
          'y': 26000
        icon:
          name: mdi:pot-steam-outline
          x: 36650
          'y': 27000
      - zones:
          - - 38303
            - 25398
            - 40131
            - 28793
        label:
          text: KĂŒche
          x: 39190
          'y': 26000
        icon:
          name: mdi:pot-steam-outline
          x: 39190
          'y': 27000
      - zones:
          - - 25035
            - 32398
            - 28900
            - 37099
        label:
          text: BĂŒro
          x: 27000
          'y': 33500
        icon:
          name: mdi:chair-rolling
          x: 27000
          'y': 35000
      - zones:
          - - 27072
            - 28637
            - 29005
            - 32241
        label:
          text: Flur
          x: 28000
          'y': 29300
        icon:
          name: mdi:home-floor-1
          x: 28000
          'y': 30800
      - zones:
          - - 25244
            - 29890
            - 27020
            - 32084
        label:
          text: Server
          x: 26000
          'y': 30300
        icon:
          name: mdi:server-network
          x: 26000
          'y': 31800
      - zones:
          - - 25244
            - 18398
            - 29318
            - 22107
        label:
          text: GĂ€stezimmer
          x: 27100
          'y': 19100
        icon:
          name: mdi:bed
          x: 27250
          'y': 20300
1 Like

You almost certainly don’t need all these values in attributes section, calibration_points should be enough. Having too many attributes creates unnecessary database load.

1 Like

Thank you for the enlightement Piotr. I am still working on this and have not yet fully understood all the logic behind it. I have just deleted all but calibration_points out of configuration.yaml and the map still displays as I want it with Lovelace. I will add more attributes as needed while working on the card.

HI, how did you get your card in the background? Can you share your Lovelace config?

Hello, (noob here)

First : lemme say thank you for your amazing work. :+1:

I got 2 Roborocks, S5 (1st floor) and S7 (2nd floor) , but i’m not able to get the second map to appear.

My config :

camera:
  - platform: xiaomi_cloud_map_extractor
    host: 'S5 IP'
    token: 'S5 Token'
    username: 'xiaomi username'
    password: 'xiaomi pwd'
    draw: ['all']
    attributes:
      - calibration_points  

  - platform: xiaomi_cloud_map_extractor
    host: 'S7 IP'
    token: 'S7 token'
    username: 'xiaomi username'
    password: 'xiaomi pwd'
    draw: ['all']
    attributes:
      - calibration_points

I only have one camera.xiaomi_cloud_map_extractor entity.
What did i miss ?

I get this errors :

Entity camera.xiaomi_cloud_map_extractor (<class 'custom_components.xiaomi_cloud_map_extractor.camera.VacuumCamera'>) implements device_state_attributes. Please report it to the custom component author.

Logger: homeassistant.components.camera
Source: helpers/entity_platform.py:592 
Integration: Caméra (documentation, issues) 
First occurred: 17:22:08 (3 occurrences) 
Last logged: 17:32:44

Entity id already exists - ignoring: camera.xiaomi_cloud_map_extractor

Logger: homeassistant.components.camera
Source: components/camera/__init__.py:502 
Integration: Caméra (documentation, issues) 
First occurred: 17:25:43 (3 occurrences) 
Last logged: 17:32:53

The camera entity camera.xiaomi_cloud_map_extractor does not support requesting width and height, please open an issue with the integration author

Thank you

You have to add “name” to both cameras and you will get a second camera entity:

camera:
  - platform: xiaomi_cloud_map_extractor
    name: 'Map S5'
    host: 'S5 IP'
    token: 'S5 Token'
    username: 'xiaomi username'
    password: 'xiaomi pwd'
    draw: ['all']
    attributes:
      - calibration_points  

  - platform: xiaomi_cloud_map_extractor
    name: 'Map S7'
    host: 'S7 IP'
    token: 'S7 token'
    username: 'xiaomi username'
    password: 'xiaomi pwd'
    draw: ['all']
    attributes:
      - calibration_points
2 Likes

Yes
Thank you so much Piotr Machowski, it works 
!

Thank you all for help and thank you @3_14 for this great Project.

4 Likes

Wow, nice work. Do you maybe want to share your code @xADDRx? Looks very good!

How change color selected to clean area/predefined zones?
Now when I select defined area to clean it lights up gently in white. It is sometimes difficult to see which zones are selected for cleaning and which are not

Here you have a list of CSS variables you can add to your theme to change card’s colors (and more)

PS this is not a correct thread for this question

1 Like

strange, since a day or 2 , i receive error below, i have a roborock s5

2022-01-01 11:28:16 ERROR (SyncWorker_7) [custom_components.xiaomi_cloud_map_extractor.camera] Failed to retrieve model
2022-01-01 11:28:31 ERROR (SyncWorker_0) [custom_components.xiaomi_cloud_map_extractor.camera] Failed to retrieve model

Me too, since this morning
. 01/01/2022 
 anything related with new year?

Millennium bug :slight_smile:

Not really. There is a bug report here. Note the explanation of @rezmus.

Hello and Happy New Year. Did not see the answer I am looking for in the thread but I am also brand new to HA, just started. Hope someone can explain my issue- I have roborock 7. I have it set up in HA using PiotrMachowski setup- Works great. What I have no idea how to do is rotate my map. I know you can, I see people talking about it but I can’t find anywhere that actually says go here enter this. I am positive it is kindergarten level but I can’t find/figure it out. can someone help me out. Thank you.

    map_transformation:
      rotate: 180

Thank you. Tried that but errored out- I can try again, most likely entered it wrong. I have3-4 days working with HA and Zero YAML exp. and your how to was great- got it installed and am slowly adding in the extras
real slow. LOL. Am I supposed to be entering this thru the code editor or the camera.py or someplace else? Thank you again. I am trying to put it in the camera.py file and get this error. - Integration error: map_transformation - Integration ‘map_transformation’ not found.

It should be put in camera’s config.

you were quicker than me
I am getting integration error map transformation Integration Integration map transformation