Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion custom_components/xiaomi_cloud_map_extractor/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,12 @@ def _handle_login(self):

def _handle_device(self):
_LOGGER.debug("Retrieving device info, country: %s", self._country)
country, user_id, device_id, model = self._connector.get_device_details(self._vacuum.token, self._country)
token = self._vacuum.token
country, user_id, device_id, model = self._connector.get_device_details(token, self._country)

if device_id is None:
_LOGGER.error("Failed to find a device matching the given token: %s", token)

if model is not None:
self._country = country
_LOGGER.debug("Retrieved device model: %s", model)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,12 @@ def get_homes_iter(self, country: str):
if (response := self.execute_api_call_encrypted(url, params)) is None:
return None

if homelist := response["result"]["homelist"]:
result = response["result"]

if homelist := result["homelist"]:
yield from (XiaomiHome(int(home["id"]), home["uid"]) for home in homelist)

if homelist := response["result"]["share_home_list"]:
if homelist := result.get("share_home_list", None):
yield from (XiaomiHome(int(home["id"]), home["uid"]) for home in homelist)

def get_devices_from_home_iter(self, country: str, home_id: int, owner_id: int):
Expand Down