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

Different map sources for each map modes #621

Closed DeDelner closed 1 year ago

DeDelner commented 1 year ago

Description

For instance, my wife didn't like the the map that is generated by the robot. So I created a neat 3D floorplan of our home and used this as a map source for room cleaning.

Now the floorplan becomes inaccurate when you want to use zone cleanup or pin & go.

Solution

The idea would be to provide map_source and calibration_source per mod_mode as optional parameters, which can overwrite the "default" ones.

Something like this:

type: custom:xiaomi-vacuum-map-card
entity: vacuum.sweepie
map_source:
  camera: camera.sweepie
calibration_source:
  camera: true
...
map_modes:
  - template: vacuum_clean_segment
    # Overwriting the parameters from above
    map_source:
      image: /local/floorplan.png
    calibration_source:
      calibration_points:
         ...
    predefined_selections:
       ...

Alternatives

No response

Context

No response

PiotrMachowski commented 1 year ago

It is already possible using additional_presets configuration:

type: custom:xiaomi-vacuum-map-card
preset_name: Live map
entity: vacuum.xiaomi_vacuum
map_source:
  camera: camera.xiaomi_cloud_map_extractor
calibration_source:
  camera: true
map_modes:
  - template: vacuum_clean_zone
  - template: vacuum_goto
  - template: vacuum_clean_zone_predefined
    predefined_selections:
      - zones: [[25500, 25500, 26500, 26500]]
      - zones: [[24245, 25190, 27495, 27940], [27492, 26789, 28942, 27889]]
additional_presets:
  - entity: vacuum.xiaomi_vacuum
    preset_name: Nice floorplan
    map_source:
      image: '/local/custom_lovelace/xiaomi_vacuum_map_card/map.png'
    calibration_source:
      calibration_points:
        - vacuum:
            x: 25500
            y: 25500
          map:
            x: 466
            y: 1889
        - vacuum:
            x: 26500
            y: 26500
          map:
            x: 730
            y: 1625
        - vacuum:
            x: 25500
            y: 26500
          map:
            x: 466
            y: 1625
    map_modes:
      - template: vacuum_clean_zone
      - template: vacuum_goto
      - template: vacuum_clean_zone_predefined
        predefined_selections:
          - zones: [[25500, 25500, 26500, 26500]]
          - zones: [[24245, 25190, 27495, 27940], [27492, 26789, 28942, 27889]]