Xiaomi Cloud Vacuum Map Extractor

Hi Lindsay.
Unfortunately this is not ready yet :frowning:

1 Like

I think I will try to incorporate it into the main repo, what do you think?

That would be great, but as I said, itā€™s not ready yet.
I have a new version that Iā€™ll push once Iā€™ve tested it a bit where I replaced the mqtt connection with HASSā€™s own mqtt. You only have add the valetudo map data camera to the config instead of mqtt connection details.
And, as mentioned above, there are still some scaling/coordinate translation issues I need to wrap my head around.
Once Iā€™ve sorted that out Iā€™ll open a PR to integrate it into the main repo.

The problem is that I plan to make some bigger refactor soon, which will make it harder to integrate your changes. Maybe you can merge it in parts, to dev branch?

Hello,

Recently, i think after one of the upgrades i started to have this error and my entity is no more availaable:
Error occurred loading configuration flow for integration xiaomi_miio: cannot import name 'ROCKROBO_S7_MAXV' from 'miio.integrations.vacuum.roborock.vacuum' (/usr/local/lib/python3.10/site-packages/miio/integrations/vacuum/roborock/vacuum.py)

I try to reinstall the integration but without any success.
Please let me know you advice.
im running:
Home Assistant 2023.3.6
Supervisor 2023.03.2
Operating System 9.5
Frontend 20230309.1 - latest

Thanks,
Alin.

This error is related to Xiaomi Miio integration, not Map Extractor

Do you have any suggestion for me?
Thanks,
Alin.

You probably use some custom integration that forces a specific version of python-miio package. You can check it in manifest.json files. Map Extractor doesnā€™t need a specific version, so the error is not caused by it.

For others, into the manifest i chaanged the version of miio from python-miio==0.5.9 to python-miio==0.5.12
Seems .10 is not anymore available in HA (that was the previous value in my deployment). This changed solved the problem.
Thanks @3_14 because you drived me to reasearch in that direction.

Thanks,
Alin.

This doesnā€™t seem to work with roborock.vacuum.a38 (Q7 Max). It works fine with my S5 Max but not the other one. Does anyone have any ideas?

Itā€™s there anything in logs?

I get these lines in the log:

2023-04-05 08:37:06.430 WARNING (MainThread) [homeassistant.components.camera] Updating xiaomi_cloud_map_extractor camera took longer than the scheduled update interval 0:00:05
2023-04-05 08:37:11.431 WARNING (MainThread) [homeassistant.helpers.entity] Update of camera.xiaomi_cloud_map_extractor is taking over 10 seconds
2023-04-05 08:37:11.432 WARNING (MainThread) [homeassistant.components.camera] Updating xiaomi_cloud_map_extractor camera took longer than the scheduled update interval 0:00:05
2023-04-05 08:37:11.539 WARNING (SyncWorker_9) [custom_components.xiaomi_cloud_map_extractor.camera] Got exception while fetching the state: Unable to discover the device 192.168.0.164
2023-04-05 08:37:14.066 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching J Edgar Hoover data

I can connect to the machine and it responds, so there is no problem with the wifi and the card works flawless with my S5 Max.

Does your vacuum (the problematic one) work with built-in Xiaomi Miio integration?

Is it named J Edgar Hoover and have IP 192.168.0.164?

Yes to both questions. J Edgar Hoover (Q7 Max) works with the integration and has ip 192.168.0.164

  1. Compare token with one retrieved with Tokens Extractor
  2. Restart your vacuum by holding start button
  3. If steps above didnā€™t help remove working vacuum from config, [enable debug logging] and restart HA. Check and send logs here

Iā€™m a bit uncertain regarding how to post the debug log since its HUGE.
The log with just warnings gives me this:

2023-04-06 14:33:18.546 WARNING (MainThread) [homeassistant.helpers.entity] Update of camera.xiaomi_cloud_map_extractor is taking over 10 seconds
2023-04-06 14:34:43.569 WARNING (MainThread) [homeassistant.components.camera] Updating xiaomi_cloud_map_extractor camera took longer than the scheduled update interval 0:00:05

Is that at all useful?
The token extractor gives me the same token, so thatā€™s not the issue. I have power cycled the vacuum and restarted home assistant.

My camera.yaml looks like this:

- platform: xiaomi_cloud_map_extractor
  host: !secret xiaomi_vacuum_host
  token: !secret xiaomi_miio_vacuum_token
  username: !secret xiaomi_cloud_username
  password: !secret xiaomi_cloud_password
  draw: #['all']
    - charger
    - cleaned_area
    - goto_path
    - vacuum_position  
    - path
    - predicted_path
    
  attributes:
    - calibration_points   
  colors:
    color_map_inside: [50, 50, 50]
    color_map_outside: [0, 0, 0]
    color_map_wall: [245, 245, 245]
    color_map_wall_v2: [230, 230, 230]
    color_grey_wall: [120, 120, 120]
    color_ignored_obstacle: [255, 255, 255, 127]
    color_ignored_obstacle_with_photo: [255, 255, 255, 127]
    color_obstacle: [255, 255, 255, 127]
    color_obstacle_with_photo: [255, 255, 255, 127]
    color_path: [50, 250, 30]
    color_goto_path: [0, 255, 0]
    color_predicted_path: [255, 255, 0, 0]
    color_cleaned_area: [127, 127, 127, 127]
    color_zones: [0xAD, 0xD8, 0xFF, 0x8F]
    color_zones_outline: [0xAD, 0xD8, 0xFF]
    color_virtual_walls: [255, 0, 0]
    color_new_discovered_area: [64, 64, 64]
    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: [150, 200, 130]
    color_robo: [255, 0, 0]
    color_room_names: [0, 0, 0]
    color_unknown: [0, 0, 0]
    color_scan: [0xDF, 0xDF, 0xDF]
  room_colors:
    1: [120, 120, 120]
    2: [120, 120, 120]
    3: [120, 120, 120]
    4: [120, 120, 120]
    5: [120, 120, 120]
    6: [120, 120, 120]
    7: [120, 120, 120]
    8: [120, 120, 120]
    9: [120, 120, 120]
    10: [120, 120, 120]
    11: [120, 120, 120]
    12: [120, 120, 120]
    13: [120, 120, 120]
    14: [120, 120, 120]
    15: [120, 120, 120]
    16: [120, 120, 120]
    17: [120, 120, 120]
    18: [120, 120, 120]
    19: [120, 120, 120]
    20: [120, 120, 120]
    21: [120, 120, 120]
    22: [120, 120, 120]
    23: [120, 120, 120]
    24: [120, 120, 120]
    25: [120, 120, 120]
    26: [120, 120, 120]
    27: [120, 120, 120]
    28: [120, 120, 120]
    29: [120, 120, 120]
    30: [120, 120, 120]
    31: [120, 120, 120]
    32: [120, 120, 120]
    33: [120, 120, 120]
    34: [120, 120, 120]
    35: [120, 120, 120] 
    
  map_transformation:
    scale: 2
    #rotate: 180
    trim:
      top: 18
      bottom: 18
      left: 14
      right: 14

EDIT:

Ok so i found something in the logs:

2023-04-06 15:11:55.291 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieved device model: roborock.vacuum.a38
2023-04-06 15:11:55.291 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Created device, used api: xiaomi
2023-04-06 15:11:55.291 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieving map name from device
2023-04-06 15:11:55.447 WARNING (SyncWorker_8) [miio.device] Found an unsupported model 'roborock.vacuum.a38' for class 'RoborockVacuum'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/
2023-04-06 15:11:55.468 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Map name retry
2023-04-06 15:11:55.468 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieving map name from device
2023-04-06 15:11:55.591 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Map name retry
2023-04-06 15:11:55.591 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieving map name from device
2023-04-06 15:11:55.713 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Map name retry
2023-04-06 15:11:55.713 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieving map name from device
2023-04-06 15:11:55.835 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Map name retry
2023-04-06 15:11:55.835 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieving map name from device
2023-04-06 15:11:55.957 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Map name retry
2023-04-06 15:11:55.957 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieving map name from device
2023-04-06 15:11:56.079 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Map name retry
2023-04-06 15:11:56.079 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieving map name from device
2023-04-06 15:11:56.201 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Map name retry
2023-04-06 15:11:56.201 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieving map name from device
2023-04-06 15:11:56.322 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Map name retry
2023-04-06 15:11:56.323 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieving map name from device
2023-04-06 15:11:56.445 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Map name retry
2023-04-06 15:11:56.445 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieving map name from device
2023-04-06 15:11:56.572 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Map name retry
2023-04-06 15:11:56.572 DEBUG (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Unable to retrieve map, reasons: Logged in - True, map name - retry, device retrieved - True

It looks like this model doesnā€™t support getting map name. Can you try using different apis: force_api: viomi, force_api: roidmi, force_api: dreame?

How do you get it to generate rooms config? Itā€™s always greyed out for me.

Dude! Thanks, not sure how I missed that. :flushed: