Xiaomi Cloud Vacuum Map Extractor

You won’t get rid of the first one. The second one is not mine :wink:

New version released! Now it supports Viomi vacuums

5 Likes

hi i am using STYJ02YM and i can’t get the map to update, i get these in the errors:

update of camera is taking more than 10 seconds

i am using 2.0.1. What can i provide to help you resolve the issue?

Thanks

Is there anything other in HA logs? Does an image appear at least once?

unfiortunately nothing else in the ha logs. can it provide more logs in debug mode?

It can, but if it doesn’t work at all then there should be some errors in logs in normal mode.

Can you send here attributes of camera entity?

camera:
  - platform: xiaomi_cloud_map_extractor
    host: 192.168.1.22
    token: tt
    username: aa
    password: xx
    draw: ['all']
    country: "de"
    name: "Soteria"
    store_map: true
    attributes:
      - calibration_points

i get this in the state:

access_token: 18addbf487f075fbb9f2ee6ab0102e83...
map_saved: null
friendly_name: Soteria
entity_picture: >-
  /api/camera_proxy/camera.soteria?token=18addbf487f075fbb9f2ee6ab0102e83e6d6345...
supported_features: 1

Can you start vacuuming? It helps sometimes…

Hey, i have a STYTJ01ZHM Xiaomi 1c, how can i tell who makes it? like is it a dreame model or another brand? I am keen to try to help development (unless it is a SQL database i am pretty useless though)

You can check your model using tokens extractor. If you want to write decoder you can use this code as a source of information.

Viomi S9 (v18) - no go.

Logger: homeassistant.helpers.entity
Source: custom_components/xiaomi_cloud_map_extractor/viomi/vacuum.py:14
Integration: xiaomi_cloud_map_extractor (documentation, issues)
First occurred: 10:25:59 PM (40 occurrences)
Last logged: 10:29:09 PM

Update for camera.xiaomi_cloud_map_extractor fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 350, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 558, in async_device_update
    raise exc
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/xiaomi_cloud_map_extractor/camera.py", line 273, in update
    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 28, in get_map
    map_data = self.decode_map(response, colors, drawables, texts, sizes, image_config)
  File "/config/custom_components/xiaomi_cloud_map_extractor/viomi/vacuum.py", line 14, in decode_map
    unzipped = zlib.decompress(raw_map)
zlib.error: Error -3 while decompressing data: incorrect header check

I’d like to answer on behalf of @andreasc as he has the same problem as me:

Starting to vacuum from Home Assistant, the hardware button or the app does not help either. Having the logs of miio.miioprotocol on debug I noticed the API calls to get the map:

I wonder if map_v1 is correct for my Roborock S5 Max (s5e). Token and login is correct, it works, on the vaccum platform. I also use openHAB in parallel in a legacy version. Wasn’t updated in a year and there the map still works.

Can I provide anything more? The map just shows OK which is really weird.

Do you have anything from map extractor in logs? OK is really weird, it should never be shown, as it should be returned only when everything is ok, so map should be available

I’m logging with everything on debug and the only lines in home-assistant.log are from other namespaces about loading the xiaomi_cloud_map_extractor. It feels like the map extractor is not logging at all:

2021-07-03 14:43:32 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration xiaomi_cloud_map_extractor which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-07-03 14:43:35 INFO (MainThread) [homeassistant.components.camera] Setting up camera.xiaomi_cloud_map_extractor
2021-07-03 14:43:35 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=xiaomi_cloud_map_extractor, service=reload>

Are there namespaces other than custom_component_xiaomi_cloud_map_extractor and miio.miioprotocol I could look for?

You can stop digging through code right now. I’m switching back and forth between old backups of the config and it seems to work fine, even with the current versions of home assistant and your custom component. Something broke in the config. Most probably I broke it. And I am now trying to boil down what it was.

Afterwards maybe we can try to add some more log message that could have helped?

Update: Unfortunately it was not a problem with the configuration. It just worked because the config folder also contains the hacs custom_components.

At least I could boil it down to the following:

  • It never works with v2.0.0+
  • It always works with v1.1.1
  • Xiaomi credentials and token are correct (issues differ when changed deliberately)
  • Uninstalling and installing the new version does not resolve it, either.

Are there any traces left after uninstalling it from hacs? The custom_components folder is definitely gone after uninstalling. Maybe some residuals in .storage or the database?

It should be enough.

Can you check v2.0.1?

No, there shouldn’t be anything left

I just tried all of the versions again:

  • 1.1.1 works fine
  • 2.0.0, 2.0.1, 2.0.2 empty (zero-bytes) image
  • 2.0.3 image saying “OK”

This is the zero-bytes empty image:

Also: the supported_features attribute is always 0 when it does not work and 1 when it does. So it’s 1 on v1.1.1 and 0 on all other versions.

Is there anything in logs in v2.0.1/v2.0.2 for xiaomi_cloud_map_extractor namespace? It can be something that appears only once at HA startup

2021-07-04 02:25:43 ERROR (SyncWorker_4) [miio.miioprotocol] Got error when receiving: timed out
2021-07-04 02:25:43 WARNING (SyncWorker_4) [custom_components.xiaomi_cloud_map_extractor.camera] Got exception while fetching the state: No response from the device

ocasionally on startup with either version. Seems to be no issue, as those requests are retried. Nothing else is logged even on debug

Hello and first congratulations on a great job. I didn’t even think it was possible :smile:
In my integration I encountered a strange problem, which probably results from my ignorance, I don’t know how to change the size of the room map, i.e. the whole. I can see the work of the vacuum cleaner, obstacles, generally everything but in a tiny picture. How to change it?

It looks like.