Skip to content
Draws the map available from a Xiaomi Vacuum cleaner flashed with Valetudo in a Home Assistant Lovelace card
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md Implement no-go area support Oct 25, 2019
hacs.json Add hacs.json Aug 21, 2019
valetudo-map-card.js

README.md

Lovelace Valetudo Map Card

Draws the map available from a Xiaomi Vacuum cleaner flashed with Valetudo in a Home Assistant Lovelace card.

Configuration

lovelace.yaml:

resources:
  - type: js
    url: /community_plugin/lovelace-valetudo-map-card/valetudo-map-card.js

configuration.yaml: Valetudo officially supports MQTT, with the preferred example configuration as follows. Unfortunately Home Assistant does not support authentication via MQTT. See below for an alternative example configuration using Valetudo's REST API (unsupported) if you prefer not to use MQTT or require authentication.

sensor:
  - platform: mqtt
    state_topic: "valetudo/roborock/state"
    json_attributes_topic: "valetudo/roborock/map_data"
    name: xiaomi_map
    value_template: 'OK'
    scan_interval: 5

Alternative configuration.yaml, using REST (unsupported):

sensor:
  - platform: rest
    resource: http://ip_of_your_vacuum/api/map/latest
    name: xiaomi_map
    json_attributes:
      - image
      - path
      - charger
      - robot
      - virtual_walls
      - no_go_areas
    value_template: 'OK'
    scan_interval: 5
    authentication: basic
    username: !secret xiaomi_map_username
    password: !secret xiaomi_map_password

authentication, username and password configuration variables are required if using Valetudo Password Authentication (undocumented). Otherwise, omit.

Card:

type: 'custom:valetudo-map-card'
entity: sensor.xiaomi_map
rotate: 0
crop:
  top: 0
  bottom: 0
  left: 0
  right: 0
min_height: 0

It's highly recommended to exclude the sensor from recorder in configuration.yaml to keep database small:

recorder:
  exclude:
    entities:
      - sensor.xiaomi_map

Options

Name Type Default Description
type string Required custom:valetudo-map-card
entity string Required Sensor to get state from
floor_color string '--valetudo-map-floor-color', '--secondary-background-color' Floor color
obstacle_weak_color string '--valetudo-map-obstacle-weak-color', '--divider-color' Weak obstacle color
obstacle_strong_color string '--valetudo-map-obstacle-strong-color', '--accent-color' Strong obstacle color
no_go_area_color string '--valetudo-no-go-area-color', '--accent-color' No go area color
virtual_wall_color string '--valetudo-virtual-wall-color', '--accent-color' Virtual wall color
virtual_wall_width number 1 Virtual wall line width
path_color string '--valetudo-map-path-color', '--primary-text-color' Path color
path_width number 1 Path line width
show_dock boolean true Draw the charging dock on the map
show_vacuum boolean true Draw the vacuum on the map
show_path boolean true Draw the path the vacuum took
dock_icon string mdi:flash The icon to use for the charging dock
dock_color string 'green' The color to use for the charging dock icon
vacuum_icon string mdi:robot-vacuum The icon to use for the vacuum
vacuum_color string '--primary-text-color' The color to use for the vacuum icon
map_scale number 1 Scale the map by this value
icon_scale number 1 Scale the icons (vacuum & dock) by this value
rotate number 0 Value to rotate the map by (default is in deg, but a value like 2rad is valid too)
crop Object {top: 0, bottom: 0, left: 0, right: 0} Crop the map
min_height string 0 The minimum height of the card the map is displayed in, regardless of the map's size itself. Suffix with 'w' if you want it to be times the width (ex: 0.5625w is equivalent to a picture card's 16x9 aspect_ratio)
You can’t perform that action at this time.