Xiaomi Cloud Vacuum Map Extractor

Hello.

I’m trying to install this for my Roborock S6 and have followed all the steps, but am hitting:

Got OSError while fetching the state: [Errno -5] Name has no usable address

Has anyone hit this before? My Xiaomi Miio for the vacuum itself is working correctly.

Can you show your config?

camera:
  - platform: xiaomi_cloud_map_extractor
    host: !secret xiaomi_vacuum_host
    token: !secret xiaomi_vacuum_token
    username: !secret xiaomi_cloud_username
    password: !secret xiaomi_cloud_password
    draw: ["all"]
    attributes:
      - calibration_points

And then my secrets.yaml file is

xiaomi_vacuum_host: "us"
xiaomi_vacuum_token: "myToken"
xiaomi_cloud_username: "myEmail"
xiaomi_cloud_password: "myPassword'

You should provide vacuum IP address in host

:man_facepalming:

That’s what I get for not properly reading the documentation and assuming it meant region. Looks like it’s working now! Thanks.

HI
any chance to support this great Extractor for Valetudo?

Check out this project:

Hi there!

any chance to support for Xiaomi Mijia Mi Robot?

Hey, do I have to use the Xiaomi app to use this integration? I need e.g. xiaomi_token etc.
I use the Roborock app for my Q8 Max+
When I added the robot to Xiaomi Home and in HA I used Xiaomi then I have twice less entities (HA) than on Roborock.

To use Map Extractor you have to use Xiaomi Home app. You can use this integration instead if you want to use Roborock app.

Helloo,

First of all what a nice integration you build for HASS! :raised_hands:
I’m working on the integration, and everything seems to works instead of the map, it’s not consistent. one time it’s loads the other time i got the error: “Failed to retrieve map from vaccuum” I have an (Xiaomi) roborock.vacuum.m1s it’s an oldy and only supported from the chinese servers. Is this supported with your integration?
This also explains the warning in the logs:

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:1263
First occurred: 13:20:46 (12 occurrences)
Last logged: 13:55:47
Update of camera.vacuum_map is taking over 10 seconds

The integration stop showing the map now completley, the ip adres in the error is correct, and in Unifi the device is connected. And i can control it through the xiaomi integration.

This error originated from a custom integration.
Logger: custom_components.xiaomi_cloud_map_extractor.camera
Source: custom_components/xiaomi_cloud_map_extractor/camera.py:326
integration: xiaomi_cloud_map_extractor (documentation, issues)
First occurred: 13:20:44 (9 occurrences)
Last logged: 14:04:48
Got exception while fetching the state: Unable to discover the device 192.168.2.75

I added the debug logging Aswell but that shows nothing extra’s

camera

Camera yml:
- platform: xiaomi_cloud_map_extractor
  username: ###
  password: ###
  country: "cn" 
  host: ##
  token: "434e444c745056553069577469735967"
  name: "Vacuum Map"
  draw: ["all"]
  attributes:
    - calibration_points
  scan_interval: 30


Map:

type: custom:xiaomi-vacuum-map-card
title: Xiaomi Vacuum Map
entity: vacuum.robin
map_source:
  camera: camera.vacuum_map
calibration_source:
  camera: true
vacuum_platform: humbertogontijo/homeassistant-roborock
map_locked: false
two_finger_pan: false
map_modes:
  - template: vacuum_clean_zone
  - template: vacuum_follow_path
  - template: vacuum_clean_zone_predefined
    predefined_selections:
      - zones:
          - - 27117
            - 21125
            - 31970
            - 23863
        label:
          text: Dining room
          x: 29543
          'y': 22494
          offset_y: 35
        icon:
          name: mdi:table
          x: 29543
          'y': 22494

Is the vacuum in the same subnet as HA?

Thank for you for the response made a typo in the ip adres… :upside_down_face:

But the the camera integration looks not that stable for my usecase, after a while i get the screen as shown below, is it possible to save the map if the robot isn’t available? When i load the yaml configuration the map is shown.

EDIT: the problem was that my AdGuard container was blocking some stuff I now bypassed the vacuum and the map is stable.

I have a follow up question, i want to change the color map, but looks like my config for the colors ins’t used by the camera. Here is my config:

camera.yaml:

- platform: xiaomi_cloud_map_extractor
  username: ####
  password: ###
  country: "cn"
  host: 192.168.1.75
  token: 434e444c745056553069577469735967
  name: "Vacuum Map"
  draw: ["all"]
  attributes:
    - calibration_points
    - rooms
  scan_interval: 300
  auto_update: true
  map_transformation:
    scale: 1
    trim:
      top: 20
      bottom: 30
      left: 10
      right: 20
  colors:
    color_path: [255, 0, 0]
  room_colors:
    1: [0, 0, 255] # Living room color (blue)
    2: [255, 165, 0] # Dining room color (orange)
    3: [255, 255, 0] # Kitchen color (yellow)
    4: [173, 216, 230] # Hall color (light blue)
    5: [255, 182, 193] # Toilet color (light pink)

camera

type: custom:xiaomi-vacuum-map-card
title: Xiaomi Vacuum Map
entity: vacuum.robin
map_source:
  camera: camera.vacuum_map
calibration_source:
  camera: true
vacuum_platform: default
map_locked: false
two_finger_pan: false
map_modes:
  - template: vacuum_clean_zone
  - template: vacuum_follow_path
  - template: vacuum_clean_zone_predefined
    predefined_selections:
      - id: 1
        zones:
          - - 27117
            - 21125
            - 31970
            - 23863
        label:
          text: Dining room
          x: 29543
          'y': 22494
          offset_y: 35
          size: 12
        icon:
          name: mdi:table
          x: 29543
          'y': 22494
          size: 20
      - id: 2
        zones:
          - - 27076
            - 23831
            - 31846
            - 25503
        label:
          text: Kitchen
          x: 29546
          'y': 24667
          offset_y: 35
          size: 12
        icon:
          name: mdi:pot-mix
          x: 29546
          'y': 24667
          size: 20
      - id: 3
        zones:
          - - 21951
            - 22437
            - 27050
            - 25913
        label:
          text: Living room
          x: 24501
          'y': 24175
          offset_y: 20
          size: 12
        icon:
          name: mdi:sofa
          x: 24501
          'y': 24175
          size: 24
      - id: 4
        zones:
          - - 21866
            - 21651
            - 23990
            - 22641
        label:
          text: Hall
          x: 22928
          'y': 22146
          offset_y: 35
          size: 12
        icon:
          name: mdi:door
          x: 22928
          'y': 22146
          size: 24
      - id: 5
        zones:
          - - 24000
            - 21410
            - 25074
            - 22527
        label:
          text: Toilet
          x: 24537
          'y': 21969
          offset_y: 35
          size: 12
        icon:
          name: mdi:toilet
          x: 24537
          'y': 21969
          size: 10

Are you sure you have used correct room ids? You can check them in the attributes of camera entity

This is the output:


access_token: ####
calibration_points: null
rooms: null
model: roborock.vacuum.m1s
used_api: xiaomi
entity_picture: >-
  /api/camera_proxy/camera.vacuum_map?token=####
friendly_name: Vacuum Map
supported_features: 1

As you can see rooms is empty, I thought these id’s where the same is I used to define the rooms in the Lovelace config. But that’s not how it works?. Where are the room numbers coming from?
Thanks in advance!
(I already made rooms in de xiaomi app)

No, these room IDs must match with ones that are generated by the vacuum. Attributes calibration_points and rooms should not be null though, is the map still visible? Is there anything in logs?

Yes got them now looked probably at the exact moment when te camera wasn’t available. It’s still not fully stable but it’s allot better then it was.

1 Like

First of all, @3_14, thank you for you work, Great job!

Guys,

I have the Robock S5, and I’m facing the issue “Failed to retrieve map from vacuum” in the default card:

image

But the Mi Home application shows the map correctly, the vacuum settings is set to save the map (Map saved mode (Beta) = on), and default card with Xiaomi Miio integration works fine too.

I’m using Home Assistant OS on a Raspberry PI 4 8Gb with the last version (Core 2024.5.5).

Here is my configuration.yaml:

camera:
  - platform: xiaomi_cloud_map_extractor
    host: sg
    token: !secret xiaomi_vacuum_token
    username: !secret xiaomi_cloud_username
    password: !secret xiaomi_cloud_password
    country: sg
    name: “Faxineira”
    draw: ["all"]
    attributes:
      - calibration_points

In the Home Assistant log, I got this error message:

Registrador: custom_components.xiaomi_cloud_map_extractor.camera
Fonte: custom_components/xiaomi_cloud_map_extractor/camera.py:323
integração: xiaomi_cloud_map_extractor (documentação, problemas)
Ocorreu pela primeira vez: 10:12:21 (1280 ocorrências)
Último registro: 10:24:43

Got OSError while fetching the state: [Errno -5] Name has no usable address

Could someone help-me to make this integration works?

Thanks in advanced!

Sorry guys, I hadn’t looked at the log before and done a search, my problem was the same as the @AndyReifman .

I put the country code in the host variable, this confusion was probably due to the use of Token Extractor before:

image

Now, my config is:

camera:
  - platform: xiaomi_cloud_map_extractor
    host: "VACUUM_IP"
    token: !secret xiaomi_vacuum_token
    username: !secret xiaomi_cloud_username
    password: !secret xiaomi_cloud_password
    country: sg
    name: “Faxineira”
    draw: ["all"]
    attributes:
      - calibration_points
      - charger
      - goto
      - goto_path
      - goto_predicted_path
      - image
      - map_name
      - no_go_areas
      - no_mopping_areas
      - obstacles
      - path
      - room_numbers
      - rooms
      - vacuum_position
      - vacuum_room
      - walls
      - zones

One small suggestion:
I do not recommend configuring attributes you don’t need - it will make everything slower and will unnecessarily take up DB space

1 Like