Service vacuum.xiaomi_clean_zone
with data
{
"entity_id": "vacuum.xiaomi_vacuum_cleaner",
"zone":[[29600,25705,30193,26288]],
"repeats":1
}
works fine
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
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.
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.
This behavior is very weird, map should fill whole width of a card. Are you sure that the image is correctly cropped?
How could I have missed that!
Thanks.
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:
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.
@tormagj I am very glad you like it
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
Well, it turned out that the future was very near
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.
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.
It looks great! Please let me know if zones script works
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
Main disadvantage is that after each zone it is starting to return to the base Buuuuuut I am working on it