Xiaomi Cloud Vacuum Map Extractor

You have to add trimming to your config

Sorry, Iā€™m new to these bricks and found nothing like that in the developer tools

For me it looks like this:

access_token: xxxxx
calibration_points:

  • vacuum:
    x: 0
    ā€˜yā€™: 0
    map:
    x: 400
    ā€˜yā€™: 399
  • vacuum:
    x: 1
    ā€˜yā€™: 0
    map:
    x: 420
    ā€˜yā€™: 399
  • vacuum:
    x: 0
    ā€˜yā€™: 1
    map:
    x: 400
    ā€˜yā€™: 379
    model: viomi.vacuum.v8
    used_api: viomi
    friendly_name: Xiaomi Cloud Map Extractor
    entity_picture:> -
    /api/camera_proxy/camera.xiaomi_cloud_map_extractor?
    token = xxxx
    supported_features: 1

There are no such entries as below

trim map false 0
Configure the map triming.
Each crop direction is a percentage: a value of 25 means that a quarter of the image size is cropped within that dimension. Available buttons: [left, right, up, down]

Itā€™s not in dev tools, but in cameraā€™s configuration in yaml. Here you have an example usage of trimming

Well, I have a request, another one for a freshman. :stuck_out_tongue_winking_eye: What the notation / syntax should look like. Iā€™m plugging it and itā€™s still wrong.

These values should be correct for your map:

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  
    map_transformation:
      scale: 2
      trim:
        top: 45
        bottom: 30
        left: 35
        right: 35

Oh yes, itā€™s perfect now. I will analyze your entry and see if I can handle further modifications. Thank you very much.

@gersilex Can you try running version from this branch with debug logs?

Btw, I forgot to mention that @andreasc has solved the problem by providing a correct token.

1 Like

With pleasure. It yields the ā€œempy (zero-bytes) imageā€ from my previous reply.

With this configuration

camera:
  - name: Simple Camera
    platform: xiaomi_cloud_map_extractor
    host: scruffy.nest.de
    token: !secret xiaomi_vacuum_token
    username: !secret xiaomi_cloud_username
    password: !secret xiaomi_cloud_password
    country: de

it prints these logs after a restart and those continue in the same interval:

2021-07-08 12:28:54 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration google_home which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-07-08 12:28:54 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration garbage_collection which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-07-08 12:28:54 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration presence_simulation which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-07-08 12:28:54 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration spotcast which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-07-08 12:28:54 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration browser_mod which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-07-08 12:28:54 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration meteoalarmeu which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-07-08 12:28:54 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration xiaomi_cloud_map_extractor which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-07-08 12:28:54 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration trakt which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-07-08 12:28:54 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration alexa_media which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-07-08 12:28:54 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-07-08 12:28:58 DEBUG (SyncWorker_3) [custom_components.xiaomi_cloud_map_extractor.camera] Logging in...
2021-07-08 12:28:58 DEBUG (SyncWorker_5) [custom_components.xiaomi_cloud_map_extractor.camera] Logging in...
2021-07-08 12:28:59 DEBUG (SyncWorker_3) [custom_components.xiaomi_cloud_map_extractor.camera] Logged in
2021-07-08 12:28:59 DEBUG (SyncWorker_3) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieving device info, country: de
2021-07-08 12:28:59 DEBUG (SyncWorker_5) [custom_components.xiaomi_cloud_map_extractor.camera] Logged in
2021-07-08 12:28:59 DEBUG (SyncWorker_5) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieving device info, country: de
2021-07-08 12:28:59 DEBUG (SyncWorker_3) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieving map name from device
2021-07-08 12:28:59 DEBUG (SyncWorker_5) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieving map name from device
2021-07-08 12:28:59 ERROR (SyncWorker_1) [spotipy.client] HTTP Error for GET to https://api.spotify.com/v1/me/ returned 401 due to The access token expired
2021-07-08 12:29:05 DEBUG (SyncWorker_3) [custom_components.xiaomi_cloud_map_extractor.camera] Map name rubyslite%2F322176735%2F16
2021-07-08 12:29:05 DEBUG (SyncWorker_3) [custom_components.xiaomi_cloud_map_extractor.camera] Unable to retrieve map, reasons: Logged in - True, map name - rubyslite%2F322176735%2F16, device retrieved - False
2021-07-08 12:29:08 DEBUG (SyncWorker_7) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieving device info, country: None
2021-07-08 12:29:10 DEBUG (SyncWorker_5) [custom_components.xiaomi_cloud_map_extractor.camera] Map name rubyslite%2F322176735%2F17
2021-07-08 12:29:10 DEBUG (SyncWorker_5) [custom_components.xiaomi_cloud_map_extractor.camera] Unable to retrieve map, reasons: Logged in - True, map name - rubyslite%2F322176735%2F17, device retrieved - False
2021-07-08 12:29:21 DEBUG (SyncWorker_7) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieving map name from device
2021-07-08 12:29:21 DEBUG (SyncWorker_7) [custom_components.xiaomi_cloud_map_extractor.camera] Map name rubyslite%2F322176735%2F0
2021-07-08 12:29:21 DEBUG (SyncWorker_7) [custom_components.xiaomi_cloud_map_extractor.camera] Unable to retrieve map, reasons: Logged in - True, map name - rubyslite%2F322176735%2F0, device retrieved - False
2021-07-08 12:29:21 ERROR (SyncWorker_3) [spotipy.client] HTTP Error for GET to https://api.spotify.com/v1/me/ returned 401 due to The access token expired
2021-07-08 12:29:23 DEBUG (SyncWorker_1) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieving device info, country: None

Did by any chance the token format change between v1 and v2?

Nooo, it shouldnā€™t. I see that it fails to retrieve device information. It tries to match device by comparing token and IP address. Can you check if token extractor returns the same values as in your config?

1 Like

They are identical:

As you can see I use the FQDN of the vacuum and not the IP. Could it be an issue when comparing the token and IP address?

Edit: It works when using the IP address instead of the hostname!

That should be itā€¦ I think I can change approach to match only by token instead

Yes, it was the problem. Either change that or resolve the hostname upfront. But that might require unneccessary dependencies and increase complexity without bringing much benefit.

Hi,

Iā€™m having a issue with the blueprint.

Error: Error rendering service name template: UndefinedError: ā€˜dict objectā€™ has no attribute ā€˜to_stateā€™

Template variable error: ā€˜dict objectā€™ has no attribute ā€˜to_stateā€™ when rendering ā€˜{% if trigger.to_state.state in [ā€œunavailableā€, ā€œunknownā€, ā€œdockedā€] %} camera.turn_off {% else %} camera.turn_on {% endif %}ā€™

I reviewed docs and blueprint seems correct. I canā€™t find the issue.

Hi,
Iā€™m trying to solve a problem with rotating map in my vacuum. It causes vacuum goes in a wrong direction when zoned cleaning is used. I partly solved this problem but I think it could be done better. Actually I have two sets of coordinates, and then I choose one depending on the vacuum position.
Is it possible to make zoned cleaning resistant to mapā€™s rotating easier by using xiaomi cloud vacuum map extractor or lovelelace xiaomi map card?

You can suggest a solution for map rotation detection and correction, I havenā€™t tried to do it so far

Noting that the map does not show the vacuum track as it was before. Nothing else changed.

Hello all,
please i follow all the instructions i create an entity for camera but the error i get is ā€œfailed to retrievev map from vacuumā€
I suppose that i have complete all the steps correctly as i foolowed the instructions.
Any suggestion?
thank you!

Check if there is anything suspicious in logs. You can also enable debug logging:

logger:
  default: info
  logs:
    custom_components.xiaomi_cloud_map_extractor: debug

thanks for answer me! I will go that way when i get back and i will see.
I believe i have done everything correct. i didnā€™t go through HACS. hope this did not affect the installation.
But iā€™ve seen the entity.

hello again, i checked my logs and seem that the device is not responding
image

The vacuum entity i have to delete it or not? now i had remove it.
I can confirm that i received normally the map! The problem was the extraction token.
Two different tokens for EU servers.
Thank you for your kind help!