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

Rockrobo v1 random map rotation

Open Crickus opened this issue 2 years ago • 12 comments

Description

Is there any solution for random map 180 rotation at rockrobo v1 at every cleaning start? I know what it's MiHome problem, not extractor.

Solution

Maybe it's possible to analyse image during extraction to auto rotate it? Some kind of test check "vacuum should start cleaning from the base situated in upper left corner" or something like this? Or maybe someone already tried to do script/automatisation patch for this issue?

Alternatives

No response

Context

No response

Crickus avatar Jun 09 '22 17:06 Crickus

Can you provide some examples of maps in different rotations? Is it the same as just rotating the whole image or does items on the map move as well?

PiotrMachowski avatar Jun 09 '22 17:06 PiotrMachowski

I almost sure what I saw topic about this issue at your v1 map repo, but with no solution. This is the map image from your v1 project. It's cleared, but it present normal room direction. Vacuum station is in the upper left room. map_новый размер

Sometimes vacuum at cleaning start rotates map at 90 degrees. Today it rotated map at 180. Capture+_2022-06-09-22-22-44_новый размер

What's why I stopped using previous version. Map has changed randomly and coordinates have moved vacuum into wrong position.

As I understand it's some kind of Xiaomi defence algorithm to excludes more expensive models features from the cheapest one))

Crickus avatar Jun 09 '22 19:06 Crickus

Yes, there's no solution at this moment.

Can you provide raw images from Map Extractor instead? Ideally from config without map trimming

PiotrMachowski avatar Jun 09 '22 19:06 PiotrMachowski

got the same problem, the most times the roborock scans, the rotation is wrong.

t0bse avatar Jun 10 '22 11:06 t0bse

I pulled two images with different orientation today. It took three attempts (first and second was with the same orientation). map_image_rockrobo vacuum v1 map_image_rockrobo vacuum v1_reversed

Crickus avatar Jun 10 '22 19:06 Crickus

Can you change config of map extractor to following:

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
      - image

and check out if this template correctly recognizes location of docking station?

{% set docking = state_attr('camera.xiaomi_cloud_map_extractor', 'calibration_points')[0].map %}
{% set image = state_attr('camera.xiaomi_cloud_map_extractor', 'image').dimensions %}
{% set center = {'x': image.width * image.scale / 2, 'y': image.height * image.scale / 2, } %}
{{ ('upper' if docking.y <= center.y else 'lower') + '_' + ('left' if docking.x <= center.x else 'right') }}

PiotrMachowski avatar Jun 10 '22 19:06 PiotrMachowski

Yep. Your template recognized corner perfectly. If I understand your idea we need to wait until map changes it orientation and check it once again, right? map template

Crickus avatar Jun 10 '22 20:06 Crickus

If I understand your idea we need to wait until map changes it orientation and check it once again, right?

Exactly. Also please check if CPU/RAM usage stayed at the same level

PiotrMachowski avatar Jun 10 '22 20:06 PiotrMachowski

The reversed map also recognized perfectly. CPU/RAM show more or less stable consumption (I have old Rasp3 HA server) . mem1 proc1 template_reverse One more detail. I'm not sure does vacuum rotate only the map or whole coordinates field. Even if we rotate the map in HA to normal direction, coordinates we transmit to API will be reversed, am I right?

Crickus avatar Jun 13 '22 07:06 Crickus

@PiotrMachowski the code works for me, too. any news on this?

t0bse avatar Sep 13 '22 16:09 t0bse

Could you please give an advice, how to enable room cleaning? I mapped rooms, but when i press start button (play button near x1 in a right side) - vacuum do nothing. Rooms a selectable, but after pressing start - it becomes unchecked and no response from vacuum. Xiaomi ver.1 P.S. I am ttrying to add an screenshot here, but "something went wrong"

LexaBukreev avatar Nov 28 '22 10:11 LexaBukreev

@LexaBukreev v1 vacuum doesn't support room cleaning

PiotrMachowski avatar Nov 28 '22 10:11 PiotrMachowski