Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor icon indicating copy to clipboard operation
Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor copied to clipboard

Failed to retrieve map from vacuum - when user has more than one home

Open osieckiAdam opened this issue 1 year ago • 1 comments

Checklist

  • [X] I have updated the integration to the latest version available
  • [X] I have checked if the problem is already reported

The problem

When there is more than one home assigned to user, map could not be retrieved. Token extractor works fine for me, so I was sure that token and the IP are correct.

I debugged the code a little bit, and here's what I discovered:

xiaomi_cloud_connector is always checking only first home in each country when looking for devices (see line 140). If the device that we are looking for is not assigned to our first home then devices are empty, so eventually in camera.py method update we end up with else branch in line 279 (self._device is not None == false)

This part can be easily fixed by using the same code from Token Extractor (https://github.com/PiotrMachowski/Xiaomi-cloud-tokens-extractor/blob/master/token_extractor.py - starting from line 275) which fixes part of the problem - if token is correct, then we get our device, no matter to which home it is assigned to, however there is still some bug, because later, map name could not be retrieved - it is set to retry after 10 retries

What version of an integration has described problem?

v2.2.1

What was the last working version of an integration?

No response

What vacuum model do you have problems with?

roborock.vacuum.s5

What version of Home Assistant do you use?

core-2024.6.3

What type of installation are you running?

Home Assistant OS

Camera's configuration

camera:
  - platform: xiaomi_cloud_map_extractor
    country: de
    host: !secret host
    token: !secret token
    username: !secret username
    password: !secret pass
    draw: ["all"]
    attributes:
      - calibration_points

Errors shown in the HA logs (if applicable)

No response

Additional information

No response

osieckiAdam avatar Jun 20 '24 19:06 osieckiAdam

I've also got the S5, and have this problem sporadically, however I only have one home setup with my Xiaomi account...

kineticscreen avatar Jul 02 '24 10:07 kineticscreen