Advertisement
314ma

Map card config generator

Jan 12th, 2022 (edited)
1,071
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.05 KB | None | 0 0
  1. {# ----------------- PROVIDE YOUR OWN ENTITY IDS HERE ----------------- #}
  2. {% set camera_entity = "camera.xiaomi_cloud_map_extractor" %}
  3. {% set vacuum_entity = "vacuum.xiaomi_vacuum" %}
  4. {# ------------------- DO NOT CHANGE ANYTHING BELOW ------------------- #}
  5. {% set attributes = states[camera_entity].attributes %}
  6. type: custom:xiaomi-vacuum-map-card
  7. entity: {{ vacuum_entity }}
  8. map_source:
  9.   camera: {{ camera_entity }}
  10. calibration_source:
  11.   camera: true
  12. map_modes:
  13.   - template: vacuum_goto
  14.   - template: vacuum_clean_zone
  15.   - template: vacuum_clean_segment
  16.     predefined_selections:
  17. {%- for room_id in attributes.rooms %}
  18. {%- set room = attributes.rooms[room_id] %}
  19.       - id: {{room_id}}
  20.         icon:
  21.           name: "mdi:broom"
  22. {%- if "." in (room["x0"] | string) %}
  23.           x: {{ ([room["x0"], room["x1"]] | sum / 2) }}
  24.           y: {{ ([room["y0"], room["y1"]] | sum / 2) }}
  25. {%- else %}
  26.           x: {{ ([room["x0"], room["x1"]] | sum / 2) | int }}
  27.           y: {{ ([room["y0"], room["y1"]] | sum / 2) | int }}
  28. {%- endif %}
  29. {%- endfor %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement