Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor icon indicating copy to clipboard operation
Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor copied to clipboard

viomi.vacuum.v13 map format changed?

Open Uriziel01 opened this issue 3 years ago • 3 comments

Checklist

  • [X] I have updated the integration to the latest version available
  • [X] I have checked if the problem is already reported

The problem

My Viomi V3 map was not parsed correctly with the existing repository code, I've tried to clear all maps and do full cleaning to regenerate everything (seen author's comment on multiple issues that this may be the case).

Finally I've downloaded the zlib myself, unpacked it and went through the code with a hex editor, just to quickly discover some minor details where different and current code offsets/skips/sizes where wrong in few places. magic <-> map-id was failing because of that.

I've managed to fix everything, parser was failing first at navigate, then realtime and finally unknown1, but the question remains why is it so? Does Viomi V3 (v13) have two different map formats? Did xiaomi changed something in some update and the current code was not updated?

Would love to contribute and help with this but as I have only single vacuum with latest firmware and latest application I can't test anything agains prior versions. And making a PR that'll just break the integration for all the other users is pointless.

What version of am 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.v13

What version of Home Assistant do you use?

2022.6.7

What type of installation are you running?

Home Assistant Supervised

Camera's configuration

- platform: xiaomi_cloud_map_extractor
    host: ********
    token: ********
    username: ********
    password: ********
    force_api: viomi
    store_map_image: true
    store_map_raw: true
    auto_update: true
    draw: ['all']
    attributes:
      - calibration_points

Errors shown in the HA logs (if applicable)

No response

Additional information

No response

Uriziel01 avatar Jul 04 '22 23:07 Uriziel01

You can create a PR, I have several maps that I can use for testing purposes

PiotrMachowski avatar Jul 04 '22 23:07 PiotrMachowski

@PiotrMachowski I've just discovered it's even weirder than that 😄 My changed parser works as the vacuum is stationary and fails right after vacuuming starts because map file offsets changes. I'll try to give this a go over the weekend, maybe I'll figure out a way to automatically adjust parsing logic instead of manually. Do you have a workflow for local development I can follow to try with different local map files without restarting HA?

Uriziel01 avatar Jul 05 '22 08:07 Uriziel01

@Uriziel01 it's possible that there's a size of section included in the map data.

You can chceck out map processor, it should do everything you need

PiotrMachowski avatar Jul 05 '22 08:07 PiotrMachowski