Skip to content

Lovelace 小米掃地機地圖卡 地圖支援 ​

Lovelace 小米掃地機地圖卡 提供了一種用戶友好的方式,以在 Home Assistant 中完全控制基於地圖的掃地機。

雖然此卡與 Dreame Vacuum 整合完全兼容,但其自動配置生成存在一些限制和缺失功能。為了解決這個問題,此卡可以通過 自動模板 或 手動配置 來配置。

自動(使用模板) 推薦 ​

為了自動生成完整的卡片配置(支持房間和區域清潔),使用了 Home Assistant 模板編輯器。

如果 我的 Home Assistant 整合功能已啟用,可使用下方按鈕直接前往模板編輯器:

範本工具於

如需手動導航,請依照以下步驟操作:

  1. 導航到 Home Assistant 中的 開發者工具 面板。
  2. 從頂部菜單中選擇 模板 標籤。
  3. 將下面提供的模板代碼粘貼到左側的編輯器窗格中。
  4. 複製右側 結果 窗格生成的 YAML 輸出。
  5. 將生成的輸出粘貼到 Lovelace 卡片配置中。

::: 詳情 顯示模板

yaml
{# ----------------- PROVIDE YOUR OWN ENTITY IDS HERE ----------------- #}
{% set camera_entity = "camera." %}
{% set vacuum_entity = "vacuum." %}
{# ------------------- 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]]'

:::

更新實體名稱

將模板粘貼到編輯器後,別忘了更新 camera_entity 和 vacuum_entity 的值為您自己的實體名稱。

手動(從配置器) ​

通過儀表板 UI 手動配置卡片時,添加卡片後必須明確設置若干參數:

  1. 從 Vacuum Entity 下拉選單中選擇由 dreame_vacuum 整合提供的設備所屬的 vacuum 實體。
  2. 從 Map Entity 下拉選單中選擇同一設備所對應的當前地圖 (camera.{device_name}_map) 實體。
  3. 從 Vacuum Platform 下拉選單中選擇 Tasshack/dreame-vacuum。

平台選擇

吸塵器平台的預設值為 xiaomi miio。至關重要的是要從下拉選單中更改它,並明確設置為 Tasshack/dreame-vacuum。如果不更改,當卡片發送命令時,設備將變為 unavailable,因為預設命令無法被整合識別,設備將無法回應。

選擇正確的實體和平台後,點擊 Generate rooms config 按鈕以建立房間配置,然後點擊 Save 以套用更改。

yaml
type: custom:xiaomi-vacuum-map-card
entity: # Your vacuum entity
map_source:
  camera: # Map Entity
calibration_source:
  camera: true
vacuum_platform: Tasshack/dreame-vacuum

官方文件 ​