Skip to content

Commit 7c331f7

Browse files
committed
Refactor get_map_name method
1 parent 4aabcd9 commit 7c331f7

1 file changed

Lines changed: 0 additions & 20 deletions

File tree

custom_components/xiaomi_cloud_map_extractor/connector/vacuums/vacuum_xiaomi.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -115,26 +115,6 @@ def map_archive_extension(self) -> str:
115115
def map_data_parser(self) -> XiaomiMapDataParser:
116116
return self._xiaomi_map_data_parser
117117

118-
async def get_map_name(self: Self) -> str:
119-
response = self._miot_device.get_property_by(self._vacuum_map.siid,
120-
self._vacuum_map.piid)[0].get("value")
121-
122-
if response is None:
123-
return ""
124-
125-
if isinstance(response, int):
126-
return response
127-
128-
# New models → name is plain string
129-
if isinstance(response, str) and "/" in response:
130-
return response.split("/")[-1]
131-
132-
# Older models → JSON
133-
try:
134-
data = json.loads(response)
135-
return data.get("obj_name", "").split("/")[-1]
136-
except Exception:
137-
_LOGGER.debug("Unknown map name format: %s", response)
138118
async def get_map_name(self: Self) -> str:
139119
response = self._miot_device.get_property_by(self._vacuum_map.siid,
140120
self._vacuum_map.piid)[0].get("value")

0 commit comments

Comments
 (0)