Skip to content

"Xiaomi-Cloud-Map-Extractor - Unexpected error" Failed to configure: could not authenticate #730

@gcleric86-tech

Description

@gcleric86-tech

Checklist

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

The problem

Hello! It's time to log in again; it keeps asking. I select the QR-code, follow the link, and everything is fine. A check mark appears on the Xiaomi website. After that, the next step is repeated and the message "Xiaomi-Cloud-Map-Extractor - Unexpected error" appears. Failed to configure: could not authenticate What could it be?

What version of an integration has described problem?

v3.0.0-alpha-21

What was the last working version of an integration?

v3.0.0-alpha-21

What vacuum model do you have problems with?

roborock.vacuum.s5e

What version of Home Assistant do you use?

2026.02.3

What type of installation are you running?

Home Assistant OS

Camera's configuration

import logging
from typing import Self, Any

from homeassistant.components.camera import Camera, CameraEntityDescription, DOMAIN
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType

from .const import CONTENT_TYPE
from .coordinator import XiaomiCloudMapExtractorDataUpdateCoordinator
from .entity import XiaomiCloudMapExtractorEntity
from .types import XiaomiCloudMapExtractorConfigEntry
from .legacy import handle_old_config, LEGACY_PLATFORM_SCHEMA

_LOGGER = logging.getLogger(__name__)
KEY = "live_map"


PLATFORM_SCHEMA = LEGACY_PLATFORM_SCHEMA


async def async_setup_platform(
        hass: HomeAssistant,
        config: ConfigType,
        async_add_entities: AddEntitiesCallback,
        discovery_info: DiscoveryInfoType | None = None,
) -> None:
    """YAML init: import via config flow."""
    handle_old_config(hass, config)


async def async_setup_entry(
        hass: HomeAssistant,
        config_entry: XiaomiCloudMapExtractorConfigEntry,
        async_add_entities: AddEntitiesCallback,
) -> None:
    coordinator = config_entry.runtime_data.coordinator
    async_add_entities([XiaomiCloudMapExtractorCamera(coordinator, config_entry)])


class XiaomiCloudMapExtractorCamera(XiaomiCloudMapExtractorEntity, Camera):

    def __init__(
            self: Self,
            coordinator: XiaomiCloudMapExtractorDataUpdateCoordinator,
            config_entry: XiaomiCloudMapExtractorConfigEntry
    ) -> None:
        XiaomiCloudMapExtractorEntity.__init__(self, coordinator, config_entry, DOMAIN, KEY)
        Camera.__init__(self)
        self.content_type = CONTENT_TYPE
        self.entity_description = CameraEntityDescription(
            key=KEY,
            translation_key=KEY,
            entity_registry_enabled_default=False,
            entity_registry_visible_default=False,
        )

    @property
    def frame_interval(self: Self) -> float:
        return 0.2

    def camera_image(self: Self, width: int | None = None, height: int | None = None) -> bytes | None:
        data = self._data()
        if data is None:
            return None
        return data.map_image

    @property
    def extra_state_attributes(self: Self) -> dict[str, Any]:
        attrs = super().extra_state_attributes
        if (map_data := self._map_data()) is not None:
            attrs["calibration_points"] = map_data.calibration()
            attrs["rooms"] = {k: v.as_dict() for k, v in (map_data.rooms or {}).items()}
        return attrs

Errors shown in the HA logs (if applicable)

Additional information

No response

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions