Lovelace Xiaomi Vacuum Map card
This card enables you to specify target or start zoned cleanup using live or static map, just like in Mi Home app. Additionally you can define a list of zones and choose ones to be cleaned.
Go to target
Zoned cleanup
Defined zones
Configuration options
Key | Type | Required | Default | Description |
---|---|---|---|---|
entity |
string |
True |
- | ID of Xiaomi vacuum entity |
map_image |
string |
False |
- | Path to image of map |
map_camera |
string |
False |
- | Id of map camera entity |
camera_refresh_interval |
integer |
False |
5 | Update interval for map camera in seconds |
calibration_points |
list |
True |
- | Pairs of coordinates: in vacuum system and on map image. See: Calibration |
zones |
list |
False |
Empty | List of predefined zones |
modes |
list |
False |
[go_to_target, zoned_cleanup, predefined_zones] |
List of displayed modes. Possible values: go_to_target , zoned_cleanup , predefined_zones |
default_mode |
string |
False |
- | Default selected mode. Possible values: go_to_target , zoned_cleanup , predefined_zones |
debug |
boolean |
False |
false |
Enables alerts with coordinates after holding Start button. Possible values: true , false |
service |
string |
False |
vacuum.send_command |
Allows to define service used after clicking Start button. See: Defining service |
ignore_zones_limit |
boolean |
False |
false |
Disables 5 zones limit. Possible values: true , false . See: Defining service |
language |
string |
False |
en |
Language used to display card. Possible values: en , pl , es |
Example usage:
views:
- name: Example
cards:
- type: custom:xiaomi-vacuum-map-card
entity: vacuum.xiaomi_vacuum
map_image: '/local/custom_lovelace/xiaomi_vacuum_map_card/map.png'
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
zones:
- [[25500, 25500, 26500, 26500]]
- [[24215, 28125, 29465, 32175]]
- [[24245, 25190, 27495, 27940], [27492, 26789, 28942, 27889]]
- [[28972, 26715, 31072, 27915], [29457, 27903, 31107, 29203], [30198, 29215, 31498, 31215], [29461, 31228, 31511, 32478]]
Installation
- Download xiaomi-vacuum-map-card.js, coordinates-converter.js, texts.js and style.js to
/www/custom_lovelace/xiaomi_vacuum_map_card
directory:mkdir -p www/custom_lovelace/xiaomi_vacuum_map_card cd www/custom_lovelace/xiaomi_vacuum_map_card/ wget https://github.com/PiotrMachowski/Home-Assistant-Lovelace-Xiaomi-Vacuum-Map-card/raw/master/dist/xiaomi-vacuum-map-card.js wget https://github.com/PiotrMachowski/Home-Assistant-Lovelace-Xiaomi-Vacuum-Map-card/raw/master/dist/coordinates-converter.js wget https://github.com/PiotrMachowski/Home-Assistant-Lovelace-Xiaomi-Vacuum-Map-card/raw/master/dist/texts.js wget https://github.com/PiotrMachowski/Home-Assistant-Lovelace-Xiaomi-Vacuum-Map-card/raw/master/dist/style.js
- Add card to resources in
ui-lovelace.yaml
or in raw editor if you are using frontend UI editor:resources: - url: /local/custom_lovelace/xiaomi_vacuum_map_card/xiaomi-vacuum-map-card.js type: module
Calibration
To calibrate this card you have to provide exactly 3 pairs of coordinates.
Each pair must consist of:
- coordinates of point in vacuum system (extracted by FloleVac or just by sending vacuum to a desired point)
- coordinates of matching point on a map image
For the best outcome calibration points should form a right triangle.
If you have used this card before a migration guide will appear instead of actual card.
Defining service
You can use service
parameter for example to run a script instead of starting a vacuum directly. Provided service will be run with following parameters:
entity_id
- id of a vacuumcommand
- one of two:app_goto_target
- for Go to target modezoned_cleanup
- for Zoned cleanup and Predefined zones modes
params
- point or a list of zones (the same value as displayed indebug
mode)
WARNING: in current version of Home Assistant service vacuum.send_command does not support templates! |
---|
To overcome this issue you can use a script and a python script. |
Example HA script that can be used with this card is available here.
Hints
-
To find out values for
calibration_points
you can use servicevacuum.send_command
with data:{ "entity_id": "vacuum.xiaomi_vacuum", "command": "app_goto_target", "params": [25500, 25500] }
Alternatively you can use
vacuum.xiaomi_clean_zone
:{ "entity_id": "vacuum.xiaomi_vacuum", "zone": [[25500, 25500, 26500, 26500]], "repeats": 1 }
-
You can find out coordinates for zones using two methods:
- Enabling
debug
in settings, drawing zone inZoned cleanup
mode and holdingStart
button. Note: this method also works for other modes. - Android App FloleVac
- Enabling
-
To add another language modify file texts.js and set
language
parameter in cards configuration.
FAQ
-
Does this card can show live map?
Yes, to show a camera feed as a background set property
map_camera
in configuration. -
Does this card require rooted device?
No, in basic version it uses a static image as a map. Root is required to create camera that will show a live map.
-
How to create map?
You can use any image you want, the easiest way is to use screenshot from Mi Home/FloleVac.