MCPcopy
hub / github.com/PiotrMachowski/lovelace-xiaomi-vacuum-map-card

github.com/PiotrMachowski/lovelace-xiaomi-vacuum-map-card @v2.4.1 sqlite

repository ↗ · DeepWiki ↗ · release v2.4.1 ↗
548 symbols 1,058 edges 71 files 5 documented · 1%
README

HACS Default GitHub Latest Release GitHub All Releases Community Forum [![Ko-Fi][ko_fi_shield]][ko_fi] [![buycoffee.to][buycoffee_to_shield]][buycoffee_to] [![PayPal.Me][paypal_me_shield]][paypal_me] [![Revolut.Me][revolut_me_shield]][revolut_me]

Lovelace 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).

https://user-images.githubusercontent.com/6118709/140251738-7fb06e81-34b0-4bf8-b7b1-2221d0062331.mp4

Table of contents

Features

Features include:

  • Map-based controls:
  • Zoned cleaning (manual and saved)
  • Going to target (manual and saved)
  • Room cleaning
  • Following path
  • Custom services
  • Icon controls:
  • Conditional visibility
  • Customizable service calls
  • Value tiles:
  • Customizable content
  • Conditional visibility
  • Customizable service calls
  • General:
  • Multiple vacuums support
  • Multiple maps (camera/image) support
  • Fully customizable styling

Installation

HACS

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

  • Open HACS
  • Go to "Frontend" section
  • Click button with "+" icon
  • Search for "Xiaomi Vacuum Map"
  • Install repository in HACS
  • Make sure you have added this card to Lovelace resources yaml url: /hacsfiles/lovelace-xiaomi-vacuum-map-card/xiaomi-vacuum-map-card.js type: module
  • Refresh your browser

Manual

  • Download xiaomi-vacuum-map-card.js file from the latest release
  • Save downloaded file somewhere in <ha config>/www/ directory, e.g. /config/www/custom_lovelace/xiaomi-vacuum-map-card.js
  • Add saved file to Lovelace resources yaml url: /local/custom_lovelace/xiaomi-vacuum-map-card.js type: module
  • Restart HA if you had to create www directory
  • Refresh your browser

Configuration

This card contains UI configuration editor, but it is limited to only basic set of features. Its full potential can be achieved by manual yaml adjustments.

:warning::warning::warning:

You can use this configuration as an example: demo config (configuration used in full_demo.mp4).

:warning::warning::warning:

Main options

Key Type Required Default Description
title string no empty Card's title
language string no autodetected Overrides autodetected language (supported languages)
action_handler_id string no - Enables action handling
additional_presets list no empty A list of additional presets (e.g. with different map/vacuum)
All values from preset options section

Preset options

Key Type Required Default Description
preset_name string yes1 - Name of the preset
entity string yes - Vacuum entity
map_source string yes - Preset's map source
calibration_source object yes2 - Preset's calibration source
vacuum_platform string no default Preset's vacuum platform
map_locked boolean no false Default state of pan/zoom
two_finger_pan string no false Enables two finger map panning
icons list no autogenerated Preset's icons
append_icons boolean no false Enables appending configured icons to autogenerated ones instead of replacing them
tiles list no autogenerated Preset's tiles
append_tiles boolean no false Enables appending configured tiles to autogenerated ones instead of replacing them
map_modes list no autogenerated Preset's map modes
activate object no - Service call that should be executed after clicking preset name
activate_on_switch boolean no false Enables executing activate service call after switching map preset
conditions list no - List of conditions that need to be (all of them) met for preset to be shown
clean_selection_on_start boolean no true Allows to disable cleaning selection on cleanup start
internal_variables object no - Allows to specify default values for internal variables

1 If multiple presets are configured

2 Not mandatory when used with a platform that support a default calibration

Map source options

Key Type Required Default Description
camera string no1 - Entity id of map camera
image string no1 - URL of map image
crop object no no cropping Images cropping options

1 Exactly one of camera or image must be provided

Cropping options

Key Type Required Default Description
top number no 0 Image cropping value from the top (in pixels)
bottom number no 0 Image cropping value from the bottom (in pixels)
left number no 0 Image cropping value from the left (in pixels)
right number no 0 Image cropping value from the right (in pixels)

Calibration source options

Key Type Required Default Description
camera boolean no1 - Enables retrieving calibration from camera defined in map_source (Xiaomi Cloud Map Extractor)
entity string no1 - Entity with calibration returned as a state
attribute string no - Enables usage of a configured attribute instead of state of given entity
calibration_points list no1 - List of 3 or 4 calibration points
identity boolean no1 - Enables using image coordinates on map (e.g. when map is used just for rooms)
platform string no1 - Enables using a default calibration from a chosen platform (provided that it supports it)

1 Exactly one of camera, entity, calibration_points, identity or platform must be provided

Calibration points options

Each of calibration points must have a following structure:

vacuum: # coordinates of a point in a vacuum coordinate system
  x: 25500
  y: 25500
map: # coordinates of a point in a map coordinate system (can be read using e.g. Paint or Gimp)
  x: 466
  y: 1889

Manual calibration guide

Supported vacuum platforms

Following vacuum platforms are supported out of the box at this moment:

Extension points exported contracts — how you extend this code

XiaomiVacuumMapCardActionHandlerInterface (Interface)
(no doc) [2 implementers]
src/action-handler-directive.ts
HomeAssistantFixed (Interface)
(no doc)
src/types/fixes.ts
DropdownEntry (Interface)
(no doc)
src/components/dropdown-menu.ts
CoreFrontendUserData (Interface)
(no doc)
src/localize/hass/frontend.ts
Point (Interface)
(no doc)
src/pinch-zoom/pinch-zoom.ts
XiaomiVacuumMapCardActionHandlerElement (Interface)
(no doc)
src/action-handler-directive.ts
FrontendLocaleDataFixed (Interface)
(no doc)
src/types/fixes.ts
FrontendUserData (Interface)
(no doc)
src/localize/hass/frontend.ts

Core symbols most depended-on inside this repo

localize
called by 34
src/localize/localize.ts
useAmPm
called by 19
src/localize/hass/use_am_pm.ts
_localize
called by 17
src/editor.ts
_getCurrentMode
called by 15
src/xiaomi-vacuum-map-card.ts
conditional
called by 11
src/utils.ts
_selectionChanged
called by 10
src/xiaomi-vacuum-map-card.ts
bind
called by 9
src/action-handler-directive.ts
getPlatformName
called by 9
src/model/generators/platform-generator.ts

Shape

Method 276
Function 137
Class 70
Interface 52
Enum 13

Languages

TypeScript100%

Modules by API surface

src/xiaomi-vacuum-map-card.ts80 symbols
src/types/types.ts35 symbols
src/editor.ts33 symbols
src/pinch-zoom/pinch-zoom.ts32 symbols
src/utils.ts24 symbols
src/model/map_objects/map-object.ts24 symbols
src/model/generators/tiles-generator.ts20 symbols
src/action-handler-directive.ts20 symbols
src/model/map_objects/manual-rectangle.ts18 symbols
src/model/map_objects/manual-path.ts16 symbols
src/model/generators/platform-generator.ts16 symbols
src/model/generators/icon-list-generator.ts16 symbols

Dependencies from manifests, versioned

@babel/core7.15.0 · 1×
@babel/plugin-proposal-class-properties7.14.5 · 1×
@babel/plugin-proposal-decorators7.14.5 · 1×
@rollup/plugin-json4.1.0 · 1×
@typescript-eslint/eslint-plugin4.33.0 · 1×
@typescript-eslint/parser4.33.0 · 1×
change-perspective1.0.1 · 1×
cross-var1.1.0 · 1×
custom-card-helpers1.9.0 · 1×
eslint7.32.0 · 1×
eslint-config-airbnb-base14.2.1 · 1×
eslint-config-prettier8.3.0 · 1×

For agents

$ claude mcp add lovelace-xiaomi-vacuum-map-card \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact