Coder Social home page Coder Social logo

piotrmachowski / lovelace-xiaomi-vacuum-map-card Goto Github PK

View Code? Open in Web Editor NEW
1.4K 31.0 244.0 3.83 MB

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

License: MIT License

JavaScript 0.78% TypeScript 99.22%
home-assistant lovelace-card xiaomi-vacuum roborock vacuum xiaomi homeassistant home-automation neato roomba

lovelace-xiaomi-vacuum-map-card's Introduction

HACS Default GitHub Latest Release GitHub All Releases Community Forum Ko-Fi buycoffee.to PayPal.Me 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).

full_demo.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 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
    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
    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.

⚠️⚠️⚠️

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

⚠️⚠️⚠️

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:

Create a request for a new built-in platform

Adding a new platform

Icon list entry options

icons image

Key Type Required Default Description
icon string yes - An icon to be displayed (mdi)
icon_id string no - Icon ID that can be used to override the configuration
tap_action action no more-info Action that will be triggered when an icon is tapped.
Warning: use service_data instead of data
hold_action action no - Action that will be triggered when an icon is held and released.
Warning: use service_data instead of data
double_tap_action action no - Action that will be triggered when an icon is double-tapped.
Warning: use service_data instead of data
conditions list no - List of conditions that need to be (all of them) met for an icon to be shown
tooltip string no - Tooltip to be displayed on hoover
order number no - Used to sort the icons
replace_config boolean no false Marks that this icon should override the config of an already existing icon with the same icon_id
menu_id string no - Adds this icon to the menu with given ID
label string no - Label that should be displayed in the menu
variables object no - Variables that should be passed to to service calls

Menu icon additional options

Key Type Required Default Description
type string yes - Has to be set to menu
menu_id string yes - A menu ID
entity string yes - Entity that should be used to generate the menu
current_value_attribute string no - Changes the source of the selected value to given attribute
available_values_attribute string yes - Configures an attribute that contains all available values for the menu
icon_mapping object no - A mapping of possible entity value -> icon that should be used for the value
value_translation_keys object no - A mapping of possible entity value -> label that should be used for the value
tap_action object no - Action that should enable a specific value

Examples:

  • Menu based on the select entity
    type: "menu",
    menu_id: "water_box_mode",
    icon_id: "water_box_mode",
    entity: "select.water_box_mode"
    available_values_attribute: "options",
    icon: "mdi:water",
    icon_mapping:
        off: "mdi:water-remove",
        mild: "mdi:water-minus",
        moderate: "mdi:water",
        intense: "mdi:water-plus",
        custom: "mdi:water-sync"
    tap_action:
        action: "call-service",
        service: "select.select_option",
        service_data:
            option: "[[value]]",
            entity_id: "[[entity_id]]"

Tile list entry options

tiles image

Key Type Required Default Description
label string no - Label of a tile
entity string no - Entity which should be shown on a tile
internal_variable string no - Internal variable which should be shown on a tile
icon string no - An icon to be displayed (mdi)
icon_source string no - Source of an icon, e.g: vacuum.xiaomi.attributes.battery_icon
attribute string no - Attribute that should be shown on a tile
multiplier number no - Multiplier that should be used to calculate value shown on a tile
precision number no - Precision that should be used to present value on a tile
unit string no - Unit to be used
tap_action action no more-info Action that will be triggered when a tile is tapped.
Warning: use service_data instead of data
hold_action action no - Action that will be triggered when a tile is held and released.
Warning: use service_data instead of data
double_tap_action action no - Action that will be triggered when a tile is double-tapped.
Warning: use service_data instead of data
conditions list no - List of conditions that need to be (all of them) met for a tile to be shown
tooltip string no - Tooltip to be displayed on hoover
translations map no - Translations that should be applied to tile's value
tile_id string no - ID of an autogenerated tile that should be replaced with this one
order number no - Used to sort the tiles
replace_config boolean no false Marks that this tile should override the config of an already existing tile with the same tile_id
variables object no - Variables that should be passed to to service calls

Condition options

Key Type Required Default Description
entity string no - Entity ID
attribute string no - Attribute to use instead of entity state
internal_variable string no - Name of internal variable to use instead of entity state
value string no1 - Entity state/attribute has to be equal to this value
value_not string no1 - Entity state/attribute has to be unequal to this value

1 Exactly one of them has to be provided

Map modes options

map modes image

Key Type Required Default Description
template string no1 - Map mode template to be used (supported templates)
name string yes2 - Name of map mode
icon string yes2 - Icon of map mode (mdi)
selection_type string yes2 - Type of selection, one of supported ones
service_call_schema object yes2 - Service call schema that should be used in this mode
run_immediately boolean no false Enables calling service immediately after choosing a selection
coordinates_rounding boolean no true Enables coordinates rounding
max_selections integer no 1 Maximal number of selections
repeats_type string no NONE Type of repeats inclusion, one of supported ones
max_repeats integer no 1 Maximal value of repeats
variables object no - Variables that should be passed to service_call_schema
predefined_selections list no3 -

You can override any value from built-in template by providing it in your configuration

1 Not required if all parameters with (2) are provided

2 Required if template is not provided

3 Required if template is not provided and selection_type is one of: PREDEFINED_RECTANGLE, PREDEFINED_POINT, ROOM

Supported templates

List of supported templates depends on selected vacuum_platform

Supported selection types

Following selection types are supported at this moment:

  • MANUAL_RECTANGLE: Free-drawn rectangular zones on the map

    Example video
    MANUAL_RECTANGLE.mp4
  • PREDEFINED_RECTANGLE: Rectangular zones that can be selected on the map from predefined_selections

    Example video
    PREDEFINED_RECTANGLE.mp4
  • MANUAL_POINT: Point selected by clicking in an arbitrary place on the map

    Example video
    MANUAL_POINT.mp4
  • PREDEFINED_POINT: Point selected on the map from predefined_selections

    Example video
    PREDEFINED_POINT.mp4
  • ROOM: Identifier-based selection with free-drawn outline

    Example video
    ROOM.mp4
  • MANUAL_PATH: Path selected by clicking on the map

    Example video
    MANUAL_PATH.mp4

Service call schema options

Key Type Required Default Description
service string yes - Service that should be called in a given mode
service_data object no - Data that should be passed to service call
target object no - Target that should be passed to service call
evaluate_data_as_template boolean no false Enables support for jinja templates in service calls

It is possible to use several built-in placeholders in service_data section. They will be replaced by:

  • [[entity_id]]: entity_id defined in preset's config
  • [[selection]]: selection made on the map (zone, point or path)
  • [[selection_size]]: number of selections made on the map
  • [[selection_unwrapped]]: the same as [[selection]], but passed as string unwrapped from brackets
  • [[repeats]]: selected number of repeats
  • [[point_x]]: x coordinate of selected point (for MANUAL_POINT and PREDEFINED_POINT selection types)
  • [[point_y]]: y coordinate of selected point (for MANUAL_POINT and PREDEFINED_POINT selection types)
  • [[variables]]: a list of variables for all selections

It is possible to use any value from variables section (wrapped with double rectangular brackets):

variables:
  test_variable: 123
service_call_schema:
  service: fake.service
  service_data:
    var: "[[test_variable]]"

It is possible to use following modifiers in service_data section:

  • |[[jsonify]]: if value ends with this modifier it will be decoded as a JSON and attached to service call in unwrapped form
  • |[[jsonify_jinja]]: behaves in the same way as |[[jsonify]], but is executed after jinja templating

Supported repeats types

Following repeats types are supported at this moment:

  • NONE: No repeats
  • INTERNAL: Repeats number included in coordinates array ([25500, 25000, 26500, 26500, 2])
  • EXTERNAL: Repeats number used as a separate attribute in service_call_schema
  • REPEAT: Repeats selection (repeats: 2, selection: [5,6] => [5,6,5,6])

Predefined selection options

Format of data depends on selected selection_type:

  • PREDEFINED_RECTANGLE

    Key Type Required Default Description
    zones list yes - List of lists containing zone's coordinates in [x,y,width,height] format (e.g. [[25500, 25000, 26500, 26500]])
    icon object no - Icon definition
    label object no - Label definition
    variables object no - Variables that should be passed to service_call_schema

    See this page to check how to easily retrieve zone coordinates.

  • PREDEFINED_POINT

    Key Type Required Default Description
    position list yes - Point's coordinates in [x,y] format (e.g. [25500, 25000])
    icon object no - Icon definition
    label object no - Label definition
    variables object no - Variables that should be passed to service_call_schema

    See this page to check how to easily retrieve point coordinates.

  • ROOM

Key Type Required Default Description
id string or number yes - Room's identifier
outline list no - List of points forming an outline of a room (e.g. [[25500,25500],[26500,25500],[25500,26500]]
icon object no - Icon definition
label object no - Label definition
variables object no - Variables that should be passed to service_call_schema

See this page to check how to easily create outline.

Icon options

Key Type Required Default Description
name string yes - An icon to be displayed (mdi)
x number yes - X coordinate of an icon (in vacuum's coordinate system)
y number yes - Y coordinate of an icon (in vacuum's coordinate system)

Label options

Key Type Required Default Description
text string yes - Text to be displayed
x number yes - X coordinate of a label (in vacuum's coordinate system)
y number yes - Y coordinate of a label (in vacuum's coordinate system)
offset_x number no - Offset that should be applied to label in X direction (in pixels)
offset_y number no - Offset that should be applied to label in Y direction (in pixels)

Action handling

To enable handling actions you have to configure action_handler_id in Main options. This card handles following actions:

  • Starts cleaning

      tap_action:
        action: fire-dom-event
        xiaomi_vacuum_map_card:
          action_handler_id: xiaomi_vacuum_map_card_id_1
          action: cleaning.start
  • Set a value of internal variable

      tap_action:
        action: fire-dom-event
        xiaomi_vacuum_map_card:
          action_handler_id: xiaomi_vacuum_map_card_id_1
          action: internal_variable.set
          data:
            variable: variable_1
            value: "some value"
  • Selects next map mode

      tap_action:
        action: fire-dom-event
        xiaomi_vacuum_map_card:
          action_handler_id: xiaomi_vacuum_map_card_id_1
          action: map_mode.next
  • Selects previous map mode

      tap_action:
        action: fire-dom-event
        xiaomi_vacuum_map_card:
          action_handler_id: xiaomi_vacuum_map_card_id_1
          action: map_mode.previous
  • Selects a specific map mode

      tap_action:
        action: fire-dom-event
        xiaomi_vacuum_map_card:
          action_handler_id: xiaomi_vacuum_map_card_id_1
          action: map_mode.set
          data:
            index: 2 
  • Decrements a number of repeats

      tap_action:
        action: fire-dom-event
        xiaomi_vacuum_map_card:
          action_handler_id: xiaomi_vacuum_map_card_id_1
          action: repeats.decrement
  • Increments a number of repeats

      tap_action:
        action: fire-dom-event
        xiaomi_vacuum_map_card:
          action_handler_id: xiaomi_vacuum_map_card_id_1
          action: repeats.increment
  • Set a number of repeats

      tap_action:
        action: fire-dom-event
        xiaomi_vacuum_map_card:
          action_handler_id: xiaomi_vacuum_map_card_id_1
          action: repeats.set
          data:
            value: 2
  • Clears current selection

      tap_action:
        action: fire-dom-event
        xiaomi_vacuum_map_card:
          action_handler_id: xiaomi_vacuum_map_card_id_1
          action: selection.clear

FAQ

  • Make sure to check out FAQ section in Discussions, it contains a lot of useful information

  • Does this card require rooted device?

    No, it only utilizes features of Home Assistant.

  • How to create a map?

    The easiest way is to use Xiaomi Cloud Map Extractor, but you can use any image (e.g., a screenshot from Mi Home/FloleVac).

  • Can I use image that has a perspective distortion?

    Yes, you just have to provide 4 calibration points.

Migrating from v1.x.x

Configuration with map_image
Old config (v1.x.x)New config (v2.x.x)
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]]
  - [[24245, 25190, 27495, 27940], [27492, 26789, 28942, 27889]]
type: custom:xiaomi-vacuum-map-card
entity: vacuum.xiaomi_vacuum
map_source:
  image: '/local/custom_lovelace/xiaomi_vacuum_map_card/map.png'
calibration_source:
  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
map_modes:
  - template: vacuum_clean_zone
  - template: vacuum_goto
  - template: vacuum_clean_zone_predefined
    predefined_selections:
      - zones: [[25500, 25500, 26500, 26500]]
      - zones: [[24245, 25190, 27495, 27940], [27492, 26789, 28942, 27889]]

Configuration with map_camera
Old config (v1.x.x)New config (v2.x.x)
type: custom:xiaomi-vacuum-map-card
entity: vacuum.xiaomi_vacuum
map_camera: camera.xiaomi_cloud_map_extractor
camera_calibration: true
zones:
  - [[25500, 25500, 26500, 26500]]
  - [[24245, 25190, 27495, 27940], [27492, 26789, 28942, 27889]]
type: custom:xiaomi-vacuum-map-card
entity: vacuum.xiaomi_vacuum
map_source:
  camera: camera.xiaomi_cloud_map_extractor
calibration_source:
  camera: true
map_modes:
  - template: vacuum_clean_zone
  - template: vacuum_goto
  - template: vacuum_clean_zone_predefined
    predefined_selections:
      - zones: [[25500, 25500, 26500, 26500]]
      - zones: [[24245, 25190, 27495, 27940], [27492, 26789, 28942, 27889]]

Translations

Currently, this card contains translations for following languages:

  • ca - Catalan (Català)
  • cs - Czech (Čeština)
  • da - Danish (Dansk)
  • de - German (Deutsch)
  • el - Greek (Ελληνικά)
  • en - English
  • es - Spanish (Español)
  • fi - Finnish (Suomi)
  • fr - French (Français)
  • he - Hebrew (עברית)
  • hu - Hungarian (Magyar)
  • is - Icelandic (Íslenska)
  • it - Italian (Italiano)
  • nb-NO - Norwegian Bokmål (Norsk bokmål)
  • nl - Dutch (Nederlands)
  • pl - Polish (Polski)
  • pt - Portuguese (Português)
  • pt-BR - Brazilian Portuguese (Português Brasileiro)
  • ro - Romanian (Română)
  • ru - Russian (Русский)
  • sk - Slovak (Slovenčina)
  • sv - Swedish (Svenska)
  • tr - Turkish (Türkçe)
  • uk - Ukrainian (Українська)
  • zh - Chinese (中文)
  • zh-Hant - Traditional Chinese (正體中文)

Adding a new language

Special thanks

I'd like to give special thanks to people who helped me with card's design and development:

Support

If you want to support my work with a donation you can use one of the following platforms:

Platform Payment methods Link Comment
Ko-fi
  • PayPal
  • Credit card
  • Buy Me a Coffee at ko-fi.com
  • No fees
  • Single or monthly payment
  • buycoffee.to
  • BLIK
  • Bank transfer
  • Postaw mi kawę na buycoffee.to
    PayPal
  • PayPal
  • PayPal Logo
  • No fees
  • Revolut
  • Revolut
  • Credit Card
  • Revolut
  • No fees
  • lovelace-xiaomi-vacuum-map-card's People

    Contributors

    basic-steve avatar basnijholt avatar demey avatar denysdovhan avatar dependabot[bot] avatar dis90 avatar domy5 avatar dtretyakov avatar emmanuelvella avatar fbirollo avatar fragmenthor avatar gabrielcolceriu avatar gsotiriou avatar hepoh3 avatar jrada avatar konni avatar leandroissa avatar makermark avatar michelotten avatar nicholaiii avatar nova12324 avatar pedrodelcargo avatar piotrmachowski avatar rittsel avatar robin-lion avatar rogodra avatar sebpomme avatar szat688 avatar thorsten avatar tzagim avatar

    Stargazers

     avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

    Watchers

     avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

    lovelace-xiaomi-vacuum-map-card's Issues

    Suggestion: Reconfigure zone when using Zoned cleanup

    First of all, thanks for this amazing card.

    I think a good addition would be to make it possible to reconfigure zone after creating them like you can do in the app, instead of having to press "Remove last zone" and make a new one.

    Here is Czech translate

    Can you implement please?
    "cs": { mode: "Mód", goToTarget: "Poslat na zvolený bod", zonedCleanup: "Úklid zóny", zones: "Zóny", run: "Start", repeats: "Opakovat:", confirmation: "Příkaz odeslán!"

    Which Models does this work with?

    I have a Gen 1 Xiaomi that has lidar and room mapping but does not allow defining zones to clean/avoid. that capability was introduced with Gen 2.

    Will this allow me to add this functionality to my Gen 1?

    Error executing zones or target

    Hi

    i can't get the module working. having the following config:

          - type: custom:xiaomi-vacuum-map-card
            entity: vacuum.xiaomi_vacuum
            map_image: '/local/img/xiaomi_vacuum_map_card3.png'
            base_position:
              x: 605
              y: 453
            reference_point:
              x: 682
              y: 370
            zones:
              - [[19032,28186,21082,30686,1]]
              - [[22559,28852,26759,30952,1]]
              - [[18328,24990,21678,28140,1],[21682,25004,26682,28854,1]]
    

    when executing a zone cleanup the following error occurs:

    2019-08-12 21:56:50 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.139765962472976] None @ data['zone'][0]
    Traceback (most recent call last):
      File "/usr/src/app/homeassistant/components/websocket_api/commands.py", line 121, in handle_call_service
        connection.context(msg))
      File "/usr/src/app/homeassistant/core.py", line 1130, in async_call
        processed_data = handler.schema(service_data)
      File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 267, in __call__
        return self._compiled([], data)
      File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 589, in validate_dict
        return base_validate(path, iteritems(data), out)
      File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 427, in validate_mapping
        raise er.MultipleInvalid(errors)
    voluptuous.error.MultipleInvalid: None @ data['zone'][0]
    

    when using the go to target function, nothing happens, no logging at all.

    Small zoning issue on android new app

    In the responsive website, no issue at all but in the android app there is a displacement in preset zones.

    Not tried to create zones within the app.

    In the app:
    Screenshot_20191229-151722

    In the website:
    Screenshot_20191229-151917

    As it's the only card that do not works for me, I submit this issue here, but perhaps it's a bug from the app itself.

    Add to HACS

    Hi
    Is any planing to add this to HACS Community ?

    [Feature suggestion] Valetudo coordinates calculation switch

    cześć! dzięki za kawał dobrej roboty! mam małą sugestię - opiszę po angielsku, żeby reszta internetu wiedziała o co chodzi ;)

    ok, so I'm playing with your card since yesterday, and while I got it running nicely with my valetudo-rooted gen1 xiaomi vacuum robot, I was stuck for some time with coordinates calibration, just to find out that valetudo does something with y-axis, as it's mentioned numerous times even in your repo. that gave me an idea.

    what if you'd add a switch, let's say valetudo_fix or even something shorter like y_fix, with false being it's default option [if omitted], and true to get your card know it has to substract Y-coordinates from 51200 to undo "the valetudo magic". I know, it's not that hard to calculate it by ourselves, but that would speed up calibration process & also foolproof it for newer users :)
    having it false by default won't make a breaking change [I think].

    is it plausible?

    Wrong cords for zone cleaning

    After calibrate map, goto command works fine with 100% accuracy on the whole map. But with predefined zone its something wrong.

    When using cords from valetudo or FloleVac this cords are shifted on map.
    When creating zones using debug map, and save cords from alert window, everything looks good but roborock is missing zones in valetudo.

    Details:

    • Root - Valetudo
    • Addon ICantBelieveItsNotValetudo 0.2.0 to generate and crop map and generate camera map

    possible solution
    Make it possible to set the offset for predefined zones by adding x and y attributes, exactly as in the calibration

    New version of card - Live maps

    @PiotrMachowski The camera works very well, thank you for the quick enhancement of functionality. I noticed that after browser refresh map needs a few seconds before it appears by itself (I suspect that as long as the interval is set). Unless you click on it or wait - then it appears, which means it is already generated. Can anything be done about it?

    ezgif-6-85c441777004

    alse without popup:

    ezgif-4-1647725a7bcc

    Addition info: Im using ICantBelieveItsNotValetudo addon with crop settings to generate camera view.

    question: the map is flipped

    Hi
    The map is randomly drawn (flipped) when the vacuum cleaner is running. Сoordinates get lost because of this.
    how to make the vacuum cleaner draw the same map?

    PS по русски ?

    Can't get base & reference positions

    I used vacuum.send_command to go to the base position and the reference position. I'm sort of assuming the base position is where the vacuum docks - going to (25500, 25500) causes it to jiggle around near the dock. And going to (26500, 26500) is presumably forward and to the right from there. Except that would be in my neighbours house.

    I thought I would PR a suggested improvement to be able to specify a different reference point in map coordinates, so I forked the code and created a dev branch. Then I drew red circles at the base and reference points, as well as writing the coordinates to the console on mouse down (if debug was true).

    If I click where the dock is, I can enter these coords into the config, and after reloading I get a red circle in the right place. But if I click it with this point configured, it does not show in the console as (25500, 25500), so I'm not sure what's going on. Obviously it shouldn't matter if the reference point is wrong, as the base point should effectively be (0, 0).

    It started getting late so I gave up for the night. But I thought I'd let you know in case you had some ideas.

    Problem with the Installation

    Hi
    Sorry I am new to this area and need some help.

    I did everything as described. I have entered the resources in the configuration.yaml. However, I always get the message Custom element doesn't exist: xiaomi-vacuum-map-card. Can you help me please?

    image
    image

    edit button dims the page and doesnt open the card config.

    Almost everytime i click 'edit' the card just dims out and i have to refresh in order to click anywhere, sometimes it works, however most of the time it doesnt. see screenshot of it dim:

    carddim

    when im able to view/edit the card the yaml is all messed up and out of order. none of my other 26 pages full of cards do this. i have 18 other plugins/cards installed. Also, its eating ram real fast. and refreshing the picture every few seconds, something weird is going on and i cant pin point it.

    the card works, but its unusable in this condition that i cant edit it, and when its open its leaking memory.
    any ideas what i might have done wrong?
    cardconfig

    Vacuum Map

    Hello,

    i have integrated your custom card via hacs. But in my card is no map image only the drop-down menu. Do I have to create an own map image or does your py-code generate one?

    Thanks.

    request: support image with prespective

    hi,
    My floorplan image is not in 2d but have some degree of prospective (3d)
    Is possible to setup and calibrate with this image?
    Need some correction factor on y axis...

    Example config gets corrupted when added via 'Configure UI'

    I'm using the UI editing option for LoveLace (not lovelace.yml). When I paste the example config into my Raw config editor via the UI, the YML code looks fine. But when I save and exit and then go back into the editor, the YML has been sanitised to look like:

          - base_position:
              x: 399
              'y': 370
            entity: vacuum.xiaomi_vacuum
            map_image: /local/custom_lovelace/xiaomi_vacuum_map_card/map.png
            reference_point:
              x: 459
              'y': 308
            type: 'custom:xiaomi-vacuum-map-card'
            zones:
              - - - 20000
                  - 28600
                  - 26400
                  - 27800
    

    Which explains why my card is corrupted and doesn't work.

    Enhancement Request - Add Cleaning Mode

    My Robovac does not detect my new rug as a carpet and hence does not speed up the fan automatically. Any chance of adding the 'Cleaning Mode' to the UI as available in the Mi Home app.
    If that could be done then I would like any of the following options - if practical !

    1. Set any of the user pre-defined zones to be a chosen Mode.
    2. Mark a zone and choose the Mode to clean with.
    3. Allow user to set default Mode
    4. Set an area to be 'Max' and trigger Max on/off on entry/exit that area whilst in a clean. ?
      In hope !

    The problem of cleaning the created zones

    Hello! Put your great add-on but ran into a strange problem. When I select a zone, my vacuum cleaner arrives at the given room and starts beating against the wall, after which it says (zone cleaning was not completed completely). With all this, if I select this area with my hands, he takes it without problems. I am sure that the coordinates of the plot are correct, when I put a point of movement on the map, it arrives clearly at the given place. Tell me where I went wrong (
    2020-08-20_00-19-56 (2)
    2020-08-20_00-26-13 (2)

    How to create map?

    It's not clear to me from the README file, on how I go about creating the map png file. I'm also not clear on how that file is scaled WRT to the coordinates provided in the config. I.e how does it know to draw the "rooms" onto the map file so that they match the provided map image file.

    All my zones disappeared with the latest version release

    Either updating to the latest version using HACS or updating HA to 0.115.2 has resulted in my zones no longer showing up on the map image and the UI controls under the map now look different (to the docs and what they were prior). I am also not able to draw a zone or pick a spot for the "go to target" functions - nothing happens. See screenshot:

    image

    Note, I have not changed any of the config for my Lovelace UI for this card (but the latest LA update to 0.115.0 may have done some automatic formatting or changes, noting that I'm using UI to control LoveLace, not a dedicated YAML file on FS).

    I can't see anything in the logs about this component and inspecting the JS console is not showing any errors either.

    Publish as Add-On

    This is a brilliant card, thank you!

    Can it be published and installed as an AddOn?
    This would make installation and updates much easier!

    Question: Card dynamic elements styling

    Hi,
    great plugin, I've installed it for the first time lately and works like a charm, luckily I've done that before updating HA to v0.115. I have a question - is it possible to change colors of the elements like: predefined zone not-selected/selected (red/green), zone mark box (transparent white/gray) and - what is the most important for me - close/resize buttons (black)? I suppose it can't be done via card-mod plugin or similar? Maybe somewhere the js code but I am certain it would be overwritten after each update.

    Floorplan not 1:1 in lovelace

    I've been trying to get my floorplan into the card and have just realised after some testing today that it does not seem to be 1:1 scale.

    I created my floorplan at 284px x 1000px and set the base and reference points as per testing. But the card shows up as follows:

    Screen Shot 2019-09-07 at 15 37 56

    This looks to be scaled up. If I right click the floorplan in the card and save a copy, the opened image comes to 1732 x 492?

    Screen Shot 2019-09-07 at 15 38 54

    Is this an issue with the card or am I missing something? I've removed all older floorplan versions from my www folder and I've also cleared cache in my browser, but the issue exists.

    The main issue here is that I'm not able to accurately clean defined zone areas.

    Zones not updating after press 'Run" during cleaning

    Hi, thanks for a big effort of this custom card.

    When i start Xiaomi vacuum gen 1 to predeffined zone cleanup robot starts. After a while i want to add next zone, after i press run nothing happens, zones are not updating. I have to manualy pause robot and press Run again to update zones. I tried to modify .js script and add additional pause service but this seems to be not working.
    If its possible, to check if robot is claening, and if so, pause it and updates zones to be cleaned?

            if (config.service && config.service.split(".").length === 2) {
                this.service_domain = config.service.split(".")[0];
                this.service_method = config.service.split(".")[1];
    	    this.service_stop = "stop";
            } else {
                this.service_domain = "vacuum";
                this.service_method = "send_command";
    	    this.service_stop = "stop";
            }
    ...
        vacuumStartZonedCleanup(debug) {
            const zone = [];
            for (const rect of this.rectangles) {
                zone.push(this.convertMapToVacuumRect(rect, this.vacuumZonedCleanupRepeats));
            }
            if (debug && this._config.debug) {
                alert(JSON.stringify(zone));
            } else {
               this._hass.callService(this.service_domain, this.service_stop, {
    	   entity_id: this._config.entity,
    	}).then(() => this.showToast());		
                this._hass.callService(this.service_domain, this.service_method, {
                entity_id: this._config.entity,
                command: "app_zoned_clean",
                params: zone
                }).then(() => this.showToast());
            }
        }
    

    Live Maps

    I have updated my configuration to include live maps view through https://github.com/asphalter/xiaomi_vacuum with a rooted vacuum -which by the way was no way an hustle-.
    It creates a "navmap.png" file under local folder, which updates whenever the vacuum moves.
    If I include that image in the lovelace-xiaomi-vacuum-map-card config, it just caches an old picture and does not update as expected.
    If the ability to update the image of this custom card just as "local_file" camera component does is included in this component, it would make the integration complete.
    This of course is not an issue but a feature request. Thanks for the great work.

    Map size adjustment

    I have a long house floorplan and when I import an image of my own of the full floorplan, it ends up being tiny on the screen within the card.

    Is there a way to perhaps stretch this out to become larger?

    76204

    vacuum doesn't start

    Hi, first of all, amazing card! Looks really cool!

    I've been trying to use it but I'm unable to start the vacuum cleaner. My card settings:

    calibration_points:
      - map:
          x: 466
          'y': 1889
        vacuum:
          x: 25500
          'y': 25500
      - map:
          x: 730
          'y': 1625
        vacuum:
          x: 26500
          'y': 26500
      - map:
          x: 466
          'y': 1625
        vacuum:
          x: 25500
          'y': 26500
    debug: true
    entity: vacuum.xiaomi_vacuum_cleaner
    map_camera: camera.rockrobo_map
    service: vacuum.start
    type: 'custom:xiaomi-vacuum-map-card'
    
    

    When I use the developer tools like this I can start the vacuum:

    image

    The card does display the map.

    I've read #7 but I wasn't sure if it was solved now.

    Integracja z STYJ02YM

    Czy jest możliwa integracja takiej interaktywnej mapy ze stytj02ym? Próbuję to zrobić, mam wgraną miio. Mogę tam wysyłać takie koordynaty sprzątania czy tylko nazwę pomieszczenia?

    Vacuum doesn't start

    Hi 3_14,

    Congrats for this developpment, and thanks for sharing it.

    I have installed your module following you HowTo.

    Creating directories

    /home/homeassistant/.homeassistant/www/custom_lovelace/xiaomi_vacuum_map_card

    With homeassistant rights

    drwxr-xr-x 2 homeassistant homeassistant 4.0K Aug 26 14:18 xiaomi_vacuum_map_card

    Download the 3 files inside directory adding same homeassistant rights

    -rw-r--r-- 1 homeassistant homeassistant 1.1K Aug 26 09:03 style.js
    -rw-r--r-- 1 homeassistant homeassistant 442 Aug 26 09:03 texts.js
    -rw-r--r-- 1 homeassistant homeassistant 18K Aug 26 09:02 `xiaomi-vacuum-map-card.js

    Added your the ressource in top of my ui-lovelace.yaml

    resources:
      - url: /local/my-custom-card.js
        type: js
      - url: /local/my-webfont.css
        type: css
      - url: /local/custom_lovelace/xiaomi_vacuum_map_card/xiaomi-vacuum-map-card.js
        type: module
    

    And added in ui_lovelace.yaml the configuration

      - icon: mdi:robot-vacuum
        # Title of the view. Will be used as the tooltip for tab icon
        title: Interactive map
        cards:
          - type: custom:xiaomi-vacuum-map-card
            entity: vacuum.xiaomi_vacuum
            map_image: '/local/custom_lovelace/xiaomi_vacuum_map_card/map4.png'
            base_position:
              x: 201
              y: 283
            reference_point:
              x: 161
              y: 247
            zones:
              - [[25500, 25500, 26500, 26500]]
    
    

    I am able to check that my coordinates are correct, as when I display the cleaning zone [[25500, 25500, 26500, 26500]], I can see the square at the right place in the map. Cf screenshot under:

    Don't pay attention for the play/pause... buttons, they are only screenshot:

    Screenshot

    But When I click on start nothing happens. Same when I specify GoTo zone or new zoned cleanup.

    Could you give any help please ?
    Thanks in advance

    Extract map from xiaomi vacuum cleaner

    Hello,

    How did you extract your map from the vacuum cleaner?
    I can extract zones but I haven't found a way to extract the map of my apartment though.

    BR,
    Johan

    Error "cannot convert dictionary update sequence element #0 to a sequence" when setting it up

    I am trying to get this working. I have my lovelace config pretty basic. When I try either go to target, or zone cleanup, I get the error in the subject. I tried adding the python script, updating scripts.yaml with the 2 sets of examples, but it doesn't work either. Wondering if I am missing something?

    Here is my Yaml, and the full error from HA.

          - calibration_points:
              - map:
                  x: 360
                  'y': 135
                vacuum:
                  x: 27757
                  'y': 19265
              - map:
                  x: 365
                  'y': 341
                vacuum:
                  x: 27797
                  'y': 25653
              - map:
                  x: 614
                  'y': 346
                vacuum:
                  x: 34826
                  'y': 25593
            debug: false
            entity: vacuum.rockrobo
            map_image: /local/floorplan/floorplan_house.png
            type: 'custom:xiaomi-vacuum-map-card'
    
    cannot convert dictionary update sequence element #0 to a sequence
    Traceback (most recent call last):
      File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 134, in handle_call_service
        connection.context(msg),
      File "/usr/src/homeassistant/homeassistant/core.py", line 1226, in async_call
        await asyncio.shield(self._execute_service(handler, service_call))
      File "/usr/src/homeassistant/homeassistant/core.py", line 1251, in _execute_service
        await handler.func(service_call)
      File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 201, in handle_service
        self._platforms.values(), func, call, service_name, required_features
      File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 335, in entity_service_call
        future.result()  # pop exception if have
      File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 357, in _handle_service_platform_call
        await getattr(entity, func)(**data)
      File "/usr/src/homeassistant/homeassistant/components/mqtt/vacuum/schema_state.py", line 404, in async_send_command
        message.update(params)
    TypeError: cannot convert dictionary update sequence element #0 to a sequence
    

    Inquiry

    I have a paid inquiry for the creator of this project. I haven't been able to find any way to contact you, therefore, I decided I'd give this place a try.

    Please contact me at: [email protected] if you're interested.

    Request: Use get_room_mapping Numbers

    I used miio to retrieve all of my rooms via get_room_mapping. I do not need to use zone coordinates to define my rooms.

    Can this card be updated to make use of these for room numbers in addition?

    Valetudo

    hello,

    this card do not work with valetudo rooted version why ?

    Use Releases

    First of all, love this plugin, thanks for all your hard work.
    Wondering if if you can use github releases for HACS? this was the community store in HA won't say there is an update for every commit in the repo. I know it's a bit more overhead for you, but would be a nice little addition.

    Xiaomi STYJ02YM

    Hello,
    I try to use your github with Xiaomi STYJ02YM but this vacuum dont have goto_target but have a clean_target.
    Can you adapt the files so that it also works with the STY?
    Thank you

    Issue with vacuum controls in HA 0.116

    Issue occurs after update to HA 0.115.0. No errors in the log. Observed in multiple browsers.

    image

    • Zones are not being displayed on the map
    • Dropdown looks like it's expanded
    • No control to change "repeat" value

    Doesnt work under Chrome or HA App

    Hi, Thanks for this card. It really is very clever. It seems to work fine under Edge, but when I used Chrome or the new Home Assistant App, I don't see any images. Just the Mode select part.
    Any ideas as to what the issue may be ?

    Request: multi-level maps

    The new firmware is being rolled out with multi-level maps. Would it be possible to enable this on the card somehow?

    Obraz mapy

    Witam
    Mam zainstalowany twój dodatek do robota sprzątającego Xiaomi. Powiedz mi w jaki sposób zrobić mape mieszkania żeby dodać w twoim dodatku ?
    I potem te punkty calibration_points o co w tym chodzi ? I skąd wziac te punkty ?I jak potem ustawic też strefy-zone ?

    Hacs integration

    Integration with HACS is not working for me
    I received error while trying add it to Custom Repositories:
    "PiotrMachowski/Home-Assistant-Lovelace-Xiaomi-Vacuum-Map-card - No acceptable js files found"

    Request: Room Naming & Logging

    Hi, This is a great card and I've been using it for about 6 months now. Thanks.
    Just wondering if you could add the ability to name a zone (room) and fire off an entry to the Logbook when it is cleaned. That way we would be able to tell when a room was last vacuumed.

    Recommend Projects

    • React photo React

      A declarative, efficient, and flexible JavaScript library for building user interfaces.

    • Vue.js photo Vue.js

      🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

    • Typescript photo Typescript

      TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    • TensorFlow photo TensorFlow

      An Open Source Machine Learning Framework for Everyone

    • Django photo Django

      The Web framework for perfectionists with deadlines.

    • D3 photo D3

      Bring data to life with SVG, Canvas and HTML. 📊📈🎉

    Recommend Topics

    • javascript

      JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

    • web

      Some thing interesting about web. New door for the world.

    • server

      A server is a program made to process requests and deliver data to clients.

    • Machine learning

      Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

    • Game

      Some thing interesting about game, make everyone happy.

    Recommend Org

    • Facebook photo Facebook

      We are working to build community through open source technology. NB: members must have two-factor auth.

    • Microsoft photo Microsoft

      Open source projects and samples from Microsoft.

    • Google photo Google

      Google ❤️ Open Source for everyone.

    • D3 photo D3

      Data-Driven Documents codes.