PiotrMachowski / Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor

This custom integration provides a way to present a live view of a map for Xiaomi (Roborock/Viomi/Roidmi/Dreame) vacuums without a need for rooting.
MIT License
1.18k stars 124 forks source link

Map Gets Extracted But Fails To Parse #421

Closed othmanalikhan closed 1 year ago

othmanalikhan commented 1 year ago

Checklist

The problem

Problem

I can confirm that the map gets extracted from my viomi.vacuum.v8 but the Python script fails to parse it due to failing the integrity check: ValueError: error parsing section unknown2 at offset 0xee644: magic check failed. Magic: 0x1933800, Map ID: 0x0

Similar Issues

This is the same bug as encountered in #287

What version of an integration has described problem?

v2.2.0

What was the last working version of an integration?

No response

What vacuum model do you have problems with?

viomi.vacuum.v8

What version of Home Assistant do you use?

container-2023.3.6

What type of installation are you running?

Home Assistant Container

Camera's configuration

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

# Text to speech
tts:
  - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

camera:
  - platform: xiaomi_cloud_map_extractor
    host: !secret xiaomi_vacuum_host
    token: !secret xiaomi_vacuum_token
    username: !secret xiaomi_cloud_username
    password: !secret xiaomi_cloud_password
    draw: ['all']
    attributes:
      - calibration_points
    store_map_raw: true

Errors shown in the HA logs (if applicable)

2023-04-01 01:29:36.247 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 541, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 739, in async_device_update
    raise exc
  File "/usr/local/lib/python3.10/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/viomi/vacuum.py", line 23, in decode_map
    return MapDataParserViomi.parse(unzipped, colors, drawables, texts, sizes, image_config)
  File "/config/custom_components/xiaomi_cloud_map_extractor/viomi/map_data_parser.py", line 86, in parse
    MapDataParserViomi.parse_section(buf, 'unknown2', map_id)
  File "/config/custom_components/xiaomi_cloud_map_extractor/viomi/map_data_parser.py", line 243, in parse_section
    raise ValueError(
ValueError: error parsing section unknown2 at offset 0xee644: magic check failed. Magic: 0x1933800, Map ID: 0x0

Additional information

No response

PiotrMachowski commented 1 year ago

Duplicate of #153

Potentially it will disappear after a few full cleanings

othmanalikhan commented 1 year ago

I'm not sure whether it is because of the refactoring or whether because I re-generated the map couple of times. But the issue is now resolved and my map is rendering properly. Thought I would let you know.

PiotrMachowski commented 1 year ago

There wasn't any change made in the Map Extractor, so this has been solved by the re-generation of the map