PiotrMachowski / lovelace-xiaomi-vacuum-map-card

This card provides a user-friendly way to fully control map-based vacuums in Home Assistant. Supported brands include Xiaomi (Roborock/Viomi/Dreame/Roidmi/Valetudo/Valetudo RE), Neato, Wyze, Roomba, Ecovacs (and probably more).
MIT License
1.48k stars 254 forks source link

Floorplan not 1:1 in lovelace #11

Closed talondnb closed 5 years ago

talondnb commented 5 years ago

I've been trying to get my floorplan into the card and have just realised after some testing today that it does not seem to be 1:1 scale.

I created my floorplan at 284px x 1000px and set the base and reference points as per testing. But the card shows up as follows:

Screen Shot 2019-09-07 at 15 37 56

This looks to be scaled up. If I right click the floorplan in the card and save a copy, the opened image comes to 1732 x 492?

Screen Shot 2019-09-07 at 15 38 54

Is this an issue with the card or am I missing something? I've removed all older floorplan versions from my www folder and I've also cleared cache in my browser, but the issue exists.

The main issue here is that I'm not able to accurately clean defined zone areas.

PiotrMachowski commented 5 years ago

Image of a map is scaled to match a width of a card. It shouldn't affect map calibration, as coordinates of points in configuration should come from an original image. Could you provide more details about your issue with accuracy?

talondnb commented 5 years ago

I've attached my floorplan, which is drawn straight off a scaled PDF drawing of my home that was provided by the builder when we first built, so it is accurate. I've marked the docking station (green), base (red) and reference (black) points.

floorplan4-points

Here is my card configuration:

base_position:
  x: 79
  'y': 843
debug: false
default_mode: predefined_zones
entity: vacuum.roborock
map_image: /local/floorplan.png
reference_point:
  x: 112
  'y': 809
type: 'custom:xiaomi-vacuum-map-card'
zones:
  - - - 23316
      - 21161
      - 28476
      - 31415
    - - 28511
      - 28682
      - 31117
      - 30108
  - - - 24785
      - 31483
      - 31012
      - 36118
    - - 28581
      - 30244
      - 31047
      - 31874
  - - - 27480
      - 36186
      - 28319
      - 45676
    - - 28441
      - 36271
      - 30995
      - 40226
    - - 28476
      - 42077
      - 31012
      - 45574
    - - 27479
      - 45693
      - 31467
      - 49581

Now, with the above, if I command the roborock to stop directly in front of a doorway of the bedroom I want to clean, it stops short and rather than be in front of the doorway (blue) it is in front of a wall (red) and so is unable to clean the intended zone.

image

Can you advise what I can do from here? I'm running valetudo so no cloud connectivity.

PiotrMachowski commented 5 years ago

My first idea would be to use an image with higher resolution, because for big maps with small distance between calibration points even 1px can make a big difference for places that are far from them (error is multiplied by the distance).

talondnb commented 5 years ago

I was originally using much higher res but reduced it as this was before the card allowed for scroll ability on mobile devices. I'll try this again and reply with my findings.

PiotrMachowski commented 5 years ago

You can try to use the latest version of a card and calibrate it using points that will be e.g. in different corners of a map. In case of problems you can continue this thread.

talondnb commented 4 years ago

Still having issues with this, please see here:

https://community.home-assistant.io/t/xiaomi-vacuum-interactive-map-card/123901/257