Vacuum Interactive Map Card

Service vacuum.xiaomi_clean_zone with data

{
  "entity_id": "vacuum.xiaomi_vacuum_cleaner",
  "zone":[[29600,25705,30193,26288]],
  "repeats":1
}

works fine

Thank you very much! I will fix it later today

1 Like

@Maximus97 it should be working in the latest version of the card

1 Like

From now you can use this card to call your own service (e.g. script or python script) instead of default one. Primary use case for this feature was to add possibility to perform additional actions (in my case leaving garage) before starting the vacuum.

1 Like

Awesome!

I must agree with a previous post, being able to clean more than 5 zones would be awesome. But it might be too complicated to make a script for that, I have no idea as I am not a programmer.


Really like the plugin! Perhaps I missed it but any easy way to center the image?

This behavior is very weird, map should fill whole width of a card. Are you sure that the image is correctly cropped?

:grimacing: How could I have missed that!
Thanks.

1 Like

Hi everyone,

Today I have introduced a major change in calibration process. From now you are not restricted to two exact points: you can use any point you want. Moreover, if defined correctly new points will improve cards accuracy.

If you have used this card before donā€™t worry, card will provide a migration guide:

image

1 Like

Hello 3_14,

Thanks for your job, is amazing.

Today I upgraded the card from HACS but the migration message did not apear. I decided to uninstall and install again, but I donā€™t know how to calibrate the vacuum. I introduced the code:

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

But apear the message base_position not defined.

Do you know how can I introduce the calibration points?

Many thanks

After each update you have to clear browsers cache to make it effective

Many thanks, Iā€™ll try it.
Just another question. Do you know if itā€™s possible to control fan speed?
By default it uses quiet mode.

Thank U

Sure, just use service vacuum.set_fan_speed

Hi! Really great work. Made something similar before, but not even close to as elegant as this so I scrapped my work and migrated to this card.

Is it possible to integrate no-go zones and the barrier tape function, or isnā€™t it supported by the integration/services?

Also, would it be possible to add a feature to allow more than 5 zones? I know this is the limit in the app, but I was thinking to try out the node-red or scripting ways that Iā€™ve seen people use. As far as I understand, it is basically ā€œtrickingā€ the vacuum to do 5, short pause, continue with next 5. If this works, it would be great to be able to use the card together with the custom script!

Thanks again, keep up the excellent work! Cheers.

1 Like

@tormagj I am very glad you like it :slight_smile:

Right now integration doesnā€™t provide any information about no-go zones, so thereā€™s nothing I can do about it.

I can provide an option to disable zones number validation. If you have your own script you can use it by defining a service parameter: https://github.com/PiotrMachowski/lovelace-xiaomi-vacuum-map-card#defining-service
I think I will try to create similar one in the near future :wink:

1 Like

Well, it turned out that the future was very near :smiley:

I have created a script that should (not tested!) be able to make cleaning more than 5 zones possible.
It uses a python script to send commands to a vacuum, as currently vacuum.send_command service does not support templates.
Python script: vacuum_send_command.py

HA scripts:

vacuum_multiple_zones:
  alias: vacuum_multiple_zones
  sequence:
    - delay:
        milliseconds: 100
    - service: python_script.vacuum_send_command
      data_template:
        entity_id: "{{ entity_id }}"
        command: "{{ command }}"
        params: >
          {%- set parsed = (params | string).replace(" ", "").split("],[") | map("replace" ,"[", "") | map("replace", "]", "") | list -%}
          {{ "[" + parsed | first + "]" }}
    - condition: template
      value_template: "{{ command == 'app_zoned_clean' }}"
    - condition: template
      value_template: >
        {%- set parsed = (params | string).replace(" ", "").split("],[") | map("replace" ,"[", "") | map("replace", "]", "") | list -%}
        {{ "[" + parsed | select("ne", parsed | first) | list | join("],[") + "]" != "[]"}}
    - wait_template: "{{ is_state(entity_id, 'cleaning') }}"
    - wait_template: "{{ not is_state(entity_id, 'cleaning') }}"
    - service: vacuum.pause
      data_template:
        entity_id: "{{ entity_id }}"
    - service: script.vacuum_multiple_zones_launcher
      data_template:
        entity_id: "{{ entity_id }}"
        command: "{{ command }}"
        params: >
          {%- set parsed = (params | string).replace(" ", "").split("],[") | map("replace", "[", "") | map("replace", "]", "") | list -%}
          {{ "[" + parsed | select("ne", parsed | first) | list | join("],[") + "]"}}
vacuum_multiple_zones_launcher:
  alias: vacuum_multiple_zones_launcher
  sequence:
    - delay:
        milliseconds: 100
    - service: script.vacuum_multiple_zones
      data_template:
        entity_id: "{{ entity_id }}"
        command: "{{ command }}"
        params: "{{ params }}"

Usage (map card configuration):

type: custom:xiaomi-vacuum-map-card
entity: vacuum.xiaomi_vacuum
map_image: '/local/custom_lovelace/xiaomi_vacuum_map_card/map.png'
ignore_zones_limit: true
service: script.vacuum_multiple_zones
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]]

It is possible that I wonā€™t be able to test this script for a few days, but after tests I will add it to my repo.

:warning::warning::warning::warning::warning:
EDIT:
This solution is working, but vacuum starts returning to base after each zone. Final solution that does not have this issue is available in my repo: vacuum_send_command_multiple_zones.yaml

Hi 3_14, many thanks Iā€™ll find about how to use this code in the card.
Iā€™m new in HA and Iā€™m still learning.
With the last Update, Iā€™ve the map perfectly defined with the zones and works perfectly.
Great job.
Vacuum%20Map

2 Likes

It looks great! Please let me know if zones script works :slight_smile:

wow, great! I will test it as soon as I can, but out of ā€œofficeā€ a couple of days.

Ok, I have tested this script and fixed some bugs, it is working now :wink:
Main disadvantage is that after each zone it is starting to return to the base :confused: Buuuuuut I am working on it :smiley: