Tasshack / dreame-vacuum

Home Assistant integration for Dreame robot vacuums with map support
https://community.home-assistant.io/t/custom-component-dreame-vacuum
MIT License
887 stars 110 forks source link

Can't get with-xiaomi-vacuum-map-card working #687

Closed Kolia56 closed 2 months ago

Kolia56 commented 2 months ago

I'm trying to get with-xiaomi-vacuum-map-card provided example working without success so far. I noticed that this example features templating which is not supported natively by HA (2024.07.01). After some research I found the lovelace_gen extension will allow such support. So it has been installed according to documentation. Still no luck. After some more digging I found that # shall added before "{". Somehow it cures the error of the 3 set lines. Doing so for the for/endfor statement does not help. I'm wondering whether lovelace_gen is still supported. Help would be very much appreciated. Thank you The following error is triggered:

Configuration errors detected:
missed comma between flow collection entries (35:2)

 32 |         repeats: '[[repeats]]'
 33 |     predefined_selections:
 34 |     
 35 | {%- for room_id in attributes.ro ...
-------^
 36 | {%- set room = attributes.rooms[ ...
 37 |       - id: {{room_id}}

YAML code is the following:

# lovelace_gen
{# ----------------- PROVIDE YOUR OWN ENTITY IDS HERE ----------------- #}
# {% set camera_entity = "camera.r2d2_map" %}
# {% set vacuum_entity = "vacuum.r2d2" %}
{# ------------------- DO NOT CHANGE ANYTHING BELOW ------------------- #}
# {% set attributes = states[camera_entity].attributes %}
type: custom:xiaomi-vacuum-map-card
vacuum_platform: default
entity: {{ vacuum_entity }}
map_source:
  camera: {{ camera_entity }}
calibration_source:
  camera: true
map_modes:
  - template: vacuum_clean_zone
    max_selections: 10
    repeats_type: EXTERNAL
    max_repeats: 3
    service_call_schema:
      service: dreame_vacuum.vacuum_clean_zone
      service_data:
        entity_id: '[[entity_id]]'
        zone: '[[selection]]'
        repeats: '[[repeats]]'
  - template: vacuum_clean_segment
    repeats_type: EXTERNAL
    max_repeats: 3
    service_call_schema:
      service: dreame_vacuum.vacuum_clean_segment
      service_data:
        entity_id: '[[entity_id]]'
        segments: '[[selection]]'
        repeats: '[[repeats]]'
    predefined_selections:
{%- for room_id in attributes.rooms | default([]) %}
{%- set room = attributes.rooms[room_id] %}
      - id: {{room_id}}
        outline:
          - - {{room["x0"]}}
            - {{room["y0"]}}
          - - {{room["x0"]}}
            - {{room["y1"]}}
          - - {{room["x1"]}}
            - {{room["y1"]}}
          - - {{room["x1"]}}
            - {{room["y0"]}}
{%- endfor %}
  - name: Clean Spot
    icon: mdi:map-marker-plus
    max_repeats: 3
    selection_type: MANUAL_POINT
    repeats_type: EXTERNAL
    service_call_schema:
      service: dreame_vacuum.vacuum_clean_spot
      service_data:
        entity_id: '[[entity_id]]'
        points: '[[selection]]'
        repeats: '[[repeats]]'
Tasshack commented 2 months ago

Wrong repo

https://github.com/PiotrMachowski/lovelace-xiaomi-vacuum-map-card/issues

Tasshack commented 2 months ago

I am going to block you if you keep creating issues about the card. I did not make the card its another project.