Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for support of Xiaomi Robot Vacuum X20+ Robot Cleaner #531

Closed
2 of 7 tasks
gunnm80 opened this issue May 28, 2024 · 28 comments
Closed
2 of 7 tasks

Request for support of Xiaomi Robot Vacuum X20+ Robot Cleaner #531

gunnm80 opened this issue May 28, 2024 · 28 comments
Assignees
Labels
enhancement New feature or request new platform

Comments

@gunnm80
Copy link

gunnm80 commented May 28, 2024

Checklist

  • I have updated the integration to the latest version available
  • I have checked if the vacuum/platform is already requested
  • I have sent raw map file to piotr.machowski.dev [at] gmail.com (Retrieving map; please provide your GitHub username in the email)

What vacuum model do you want to be supported?

xiaomi.vacuum.c102gl

What is its name?

Xiaomi Robot Vacuum X20+ Robot Cleaner

Available APIs

  • xiaomi
  • viomi
  • roidmi
  • dreame

Errors shown in the HA logs (if applicable)

Logger: miio.device
Quelle: custom_components/xiaomi_cloud_map_extractor/camera.py:320
Integration: xiaomi_cloud_map_extractor (Dokumentation, Probleme)
Erstmals aufgetreten: 14:04:57 (7 Vorkommnisse)
Zuletzt protokolliert: 16:55:32

Found an unsupported model 'xiaomi.vacuum.c102gl' for class 'RoborockVacuum'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/

Other info

Error: Vacuum xiaomi.vacuum.c102gl is not supported

@gunnm80
Copy link
Author

gunnm80 commented May 28, 2024

Config:

  - platform: xiaomi_cloud_map_extractor
    host: 192.168.178.214
    token: !secret xiaomi_vacuum_token
    username: !secret xiaomi_cloud_username
    password: !secret xiaomi_cloud_password
    force_api: xiaomi
    country: "de"
    draw: ['all']
    attributes:
      - calibration_points
      - rooms
      - vacuum_position
    auto_update: true
    store_map_raw: true
    store_map_image: true
    store_map_path: "/tmp" 

@PiotrMachowski
Copy link
Owner

Does the map show with this config?

@gunnm80
Copy link
Author

gunnm80 commented May 28, 2024

No, sorry. this is my current configuration, which triggered the above error message.

@PiotrMachowski
Copy link
Owner

If it doesn't work then you shouldn't tick the xiaomi checkbox:

Available APIs
Please check if map appears when you use following APIs in force_api config

Have you tried other values for force_api?

@gunnm80
Copy link
Author

gunnm80 commented May 28, 2024

Sorry. I don't quite understand the checkbox. At the top of the error description?
I have run through all force_api. Without success.

@PiotrMachowski
Copy link
Owner

Sorry. I don't quite understand the checkbox. At the top of the error description?

Yes, I have fixed it.


Try removing force_api line and check if a raw map file appears

@gunnm80
Copy link
Author

gunnm80 commented May 28, 2024

I have deleted the force_api line. But without effect. No raw map was generated in the tmp folder.

@PiotrMachowski
Copy link
Owner

You most probably look at wrong /tmp folder, I suggest to change following config:

    store_map_path: "/config" 

@gunnm80
Copy link
Author

gunnm80 commented May 29, 2024

map_image_xiaomi vacuum c102gl
Thank you. Here is the picture. But still with the same error message: Vacuum xiaomi.vacuum.c102gl is not supported
I have sent it by e-mail.

@gunnm80
Copy link
Author

gunnm80 commented May 29, 2024

whit force_api: xiaomi:
map_image_xiaomi vacuum c102gl

@gunnm80
Copy link
Author

gunnm80 commented May 30, 2024

Let me know if I can help or test something.

@wmnl25
Copy link

wmnl25 commented Jun 2, 2024

+1. Let me know if you need an additional map_data_xiaomi.vacuum.c102gl.unknown file.

@Tasshack
Copy link

Tasshack commented Jun 4, 2024

This is a Dreame device and its api should be used.

@gunnm80
Copy link
Author

gunnm80 commented Jun 4, 2024

This is a Dreame device and its api should be used.

Thank you. I saw that you are also working on it. #Tasshack/dreame-vacuum#498
But it doesn't seem to be working there either. What is the correct platform / integration? My goal is to be able to control the robot completely from the Home Assistant, including the map.

@Tasshack
Copy link

Tasshack commented Jun 4, 2024

@gunnm80 support for this device will be added very soon because it's CN variant already supported and you will be able to control all of the device settings including map.

You can follow this issue.
Tasshack/dreame-vacuum#498

@gunnm80
Copy link
Author

gunnm80 commented Jun 11, 2024

1st step to the solution:: [https://github.com/Tasshack/dreame-vacuum/issues/498]

Thanks a lot @Tasshack

But the card must still come from here, if I have understood correctly.

@gunnm80 gunnm80 closed this as completed Jun 11, 2024
@gunnm80 gunnm80 reopened this Jun 11, 2024
@privedentsev
Copy link

@gunnm80 Did you manage to set it up?
Can't see my card
Снимок экрана 2024-06-11 в 07 51 35

@calipee
Copy link

calipee commented Jun 11, 2024

The map is also not working for me.

@Tasshack
Copy link

Can anyone share a log output of this integration with platform specified as dreame?

@gunnm80
Copy link
Author

gunnm80 commented Jun 11, 2024

This?

2024-06-11 18:17:05.382 WARNING (MainThread) [homeassistant.helpers.entity] Entity camera.xiaomi_cloud_map_extractor (<class 'custom_components.xiaomi_cloud_map_extractor.camera.VacuumCamera'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <CameraEntityFeature.ON_OFF: 1>, please create a bug report at https://github.com/PiotrMachowski/Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation
2024-06-11 18:17:05.384 DEBUG (SyncWorker_0) [custom_components.xiaomi_cloud_map_extractor.camera] Logging in...
2024-06-11 18:17:07.229 DEBUG (SyncWorker_0) [custom_components.xiaomi_cloud_map_extractor.camera] Logged in
2024-06-11 18:17:07.229 DEBUG (SyncWorker_0) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieving device info, country: de
2024-06-11 18:17:07.473 DEBUG (SyncWorker_0) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieved device model: xiaomi.vacuum.c102gl
2024-06-11 18:17:07.473 DEBUG (SyncWorker_0) [custom_components.xiaomi_cloud_map_extractor.camera] Created device, used api: dreame
2024-06-11 18:17:07.473 DEBUG (SyncWorker_0) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieving map from Xiaomi cloud
2024-06-11 18:17:07.754 DEBUG (SyncWorker_0) [custom_components.xiaomi_cloud_map_extractor.dreame.map_data_parser] decoding MapDataTypes.REGULAR type map
2024-06-11 18:17:07.860 ERROR (MainThread) [homeassistant.helpers.entity] Update for camera.xiaomi_cloud_map_extractor fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 941, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1291, in async_device_update
    await hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/xiaomi_cloud_map_extractor/camera.py", line 278, in update
    self._handle_map_data(map_name)
  File "/config/custom_components/xiaomi_cloud_map_extractor/camera.py", line 335, in _handle_map_data
    map_data, map_stored = self._device.get_map(map_name, self._colors, self._drawables, self._texts,
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/xiaomi_cloud_map_extractor/common/vacuum.py", line 36, in get_map
    map_data = self.decode_map(response, colors, drawables, texts, sizes, image_config)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/xiaomi_cloud_map_extractor/dreame/vacuum.py", line 24, in decode_map
    return MapDataParserDreame.decode_map(raw_map_string, colors, drawables, texts, sizes, image_config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/xiaomi_cloud_map_extractor/dreame/map_data_parser.py", line 51, in decode_map
    unzipped = zlib.decompress(base64.decodebytes(raw_map_string.encode("utf8")))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-11 18:22:05.384 DEBUG (SyncWorker_63) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieving map from Xiaomi cloud
2024-06-11 18:22:05.694 DEBUG (SyncWorker_63) [custom_components.xiaomi_cloud_map_extractor.dreame.map_data_parser] decoding MapDataTypes.REGULAR type map
2024-06-11 18:22:05.695 ERROR (MainThread) [homeassistant.helpers.entity] Update for camera.xiaomi_cloud_map_extractor fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 941, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1291, in async_device_update
    await hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/xiaomi_cloud_map_extractor/camera.py", line 278, in update
    self._handle_map_data(map_name)
  File "/config/custom_components/xiaomi_cloud_map_extractor/camera.py", line 335, in _handle_map_data
    map_data, map_stored = self._device.get_map(map_name, self._colors, self._drawables, self._texts,
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/xiaomi_cloud_map_extractor/common/vacuum.py", line 36, in get_map
    map_data = self.decode_map(response, colors, drawables, texts, sizes, image_config)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/xiaomi_cloud_map_extractor/dreame/vacuum.py", line 24, in decode_map
    return MapDataParserDreame.decode_map(raw_map_string, colors, drawables, texts, sizes, image_config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/xiaomi_cloud_map_extractor/dreame/map_data_parser.py", line 51, in decode_map
    unzipped = zlib.decompress(base64.decodebytes(raw_map_string.encode("utf8")))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-11 18:27:05.394 DEBUG (SyncWorker_42) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieving map from Xiaomi cloud
2024-06-11 18:27:05.714 DEBUG (SyncWorker_42) [custom_components.xiaomi_cloud_map_extractor.dreame.map_data_parser] decoding MapDataTypes.REGULAR type map
2024-06-11 18:27:05.715 ERROR (MainThread) [homeassistant.helpers.entity] Update for camera.xiaomi_cloud_map_extractor fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 941, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1291, in async_device_update
    await hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/xiaomi_cloud_map_extractor/camera.py", line 278, in update
    self._handle_map_data(map_name)
  File "/config/custom_components/xiaomi_cloud_map_extractor/camera.py", line 335, in _handle_map_data
    map_data, map_stored = self._device.get_map(map_name, self._colors, self._drawables, self._texts,
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/xiaomi_cloud_map_extractor/common/vacuum.py", line 36, in get_map
    map_data = self.decode_map(response, colors, drawables, texts, sizes, image_config)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/xiaomi_cloud_map_extractor/dreame/vacuum.py", line 24, in decode_map
    return MapDataParserDreame.decode_map(raw_map_string, colors, drawables, texts, sizes, image_config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/xiaomi_cloud_map_extractor/dreame/map_data_parser.py", line 51, in decode_map
    unzipped = zlib.decompress(base64.decodebytes(raw_map_string.encode("utf8")))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2024-06-11 18:32:05.394 DEBUG (SyncWorker_62) [custom_components.xiaomi_cloud_map_extractor.camera] Retrieving map from Xiaomi cloud
2024-06-11 18:32:05.707 DEBUG (SyncWorker_62) [custom_components.xiaomi_cloud_map_extractor.dreame.map_data_parser] decoding MapDataTypes.REGULAR type map
2024-06-11 18:32:05.710 ERROR (MainThread) [homeassistant.helpers.entity] Update for camera.xiaomi_cloud_map_extractor fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 941, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1291, in async_device_update
    await hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/xiaomi_cloud_map_extractor/camera.py", line 278, in update
    self._handle_map_data(map_name)
  File "/config/custom_components/xiaomi_cloud_map_extractor/camera.py", line 335, in _handle_map_data
    map_data, map_stored = self._device.get_map(map_name, self._colors, self._drawables, self._texts,
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/xiaomi_cloud_map_extractor/common/vacuum.py", line 36, in get_map
    map_data = self.decode_map(response, colors, drawables, texts, sizes, image_config)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/xiaomi_cloud_map_extractor/dreame/vacuum.py", line 24, in decode_map
    return MapDataParserDreame.decode_map(raw_map_string, colors, drawables, texts, sizes, image_config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/xiaomi_cloud_map_extractor/dreame/map_data_parser.py", line 51, in decode_map
    unzipped = zlib.decompress(base64.decodebytes(raw_map_string.encode("utf8")))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

@Tasshack
Copy link

Understand the problem. Turns out this device is not using V3 version of the Miio cloud data api like it's CN sibling so that's why this integration can access the map data but mine can't.

@Tasshack
Copy link

@gunnm80 you can close this issue with Tasshack/dreame-vacuum@86b830c

@gunnm80 gunnm80 closed this as completed Jun 11, 2024
@privedentsev
Copy link

@gunnm80 Did you understand how to use a script in the “Service” to send a vacuum cleaner to clean a specific area, not a room?

@byte4geek
Copy link

byte4geek commented Jun 13, 2024

@Tasshack I do not understand how you solve the issue of the download the map for xiaomi.vacuum.c102gl, can you explain me?

@privedentsev
Copy link

privedentsev commented Jun 13, 2024

@byte4geek

  1. Install beta Dreame Vacuum integration - https://github.com/Tasshack/dreame-vacuum/releases/tag/v2.0.0b15
  2. Connect your vacuum cleaner
  3. go to the address in the HA files custom_components/dreame_vacuum/dreame/protocol.py and replace everything in the file with this code - https://raw.githubusercontent.com/Tashhack/dreame-vacuum/dev/custom_components/dreame_vacuum/dreame/ protocol.py
  4. Restart HA

@byte4geek
Copy link

I followed your instruction but i have this in error in log:

2024-06-13 12:17:36.270 INFO (MainThread) [custom_components.dreame_vacuum] Integration loading: Xiaomi Robot Vacuum X20+
2024-06-13 12:17:36.271 INFO (MainThread) [custom_components.dreame_vacuum] Integration starting...
2024-06-13 12:17:37.811 INFO (SyncWorker_18) [custom_components.dreame_vacuum.dreame.device] Connecting to device
2024-06-13 12:17:37.858 INFO (SyncWorker_18) [custom_components.dreame_vacuum.dreame.device] Connected to device: xiaomi.vacuum.c102gl 4.3.9_1074
2024-06-13 12:17:41.943 ERROR (SyncWorker_18) [miio.miioprotocol] Got error when receiving: timed out
2024-06-13 12:17:41.946 WARNING (MainThread) [custom_components.dreame_vacuum] Integration start failed: Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/miio/miioprotocol.py", line 193, in send
    data, addr = s.recvfrom(4096)
                 ^^^^^^^^^^^^^^^^
TimeoutError: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/miio/miioprotocol.py", line 193, in send
    data, addr = s.recvfrom(4096)
                 ^^^^^^^^^^^^^^^^
TimeoutError: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/dreame_vacuum/coordinator.py", line 437, in _async_update_data
    await self.hass.async_add_executor_job(self._device.update)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/dreame_vacuum/dreame/device.py", line 2670, in update
    self.connect_device()
  File "/config/custom_components/dreame_vacuum/dreame/device.py", line 1936, in connect_device
    self._request_properties()
  File "/config/custom_components/dreame_vacuum/dreame/device.py", line 666, in _request_properties
    result = self._protocol.get_properties(props[:15])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/dreame_vacuum/dreame/protocol.py", line 1240, in get_properties
    return self.send("get_properties", parameters=parameters, retry_count=retry_count)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/dreame_vacuum/dreame/protocol.py", line 1237, in send
    return self.device.send(method, parameters=parameters, retry_count=retry_count)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/miio/miioprotocol.py", line 233, in send
    return self.send(
           ^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/miio/miioprotocol.py", line 241, in send
    raise DeviceException("No response from the device") from ex
miio.exceptions.DeviceException: No response from the device

2024-06-13 12:17:41.946 INFO (MainThread) [custom_components.dreame_vacuum.dreame.device] Disconnect

@byte4geek
Copy link

may be it is incompatible with the version 4.3.9_1074?

@byte4geek
Copy link

fixed, i must reconfigure the integration with "Prefer cloud connection" flagged, thanks a lot for your support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new platform
Projects
None yet
Development

No branches or pull requests

7 participants