To be continued… Looking forward to it
@Schneider hello!
I have the same problem : The vacuum starts, gets out of the dock, turn around and says that the cleaning is done, then return do home.
I read carefully the post, and I am wondering :
The solution is to launch from scratch a full cleaning from HA interface of vacuum ?
I have no issue to collect correct coordinates (from Valetudo or Flolevac) but it is not working when I launch them from my automation.yalm (and those same coordinates would work if I launch them with valetudo for eg)
I read that this script was working for you:
aspirador_zona_suite:
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.aspirador
command: app_zoned_clean
params: [[18931,21286,22581,23936,1],[21250,23964,22100,25464,1]]
- service: script.aspirador_alerta_iniciando
But there are 2 zones on your script, right ?
I hope someone will help me with this !
Thanks!
Hello sir! How are you?
Yes, this is a very common problem with this project. Maps gets rotated, mirrored out of the blue.
I’ve been problem-free for months now. My solution was to create a scripts that starts a full cleanup, waits a few seconds and send the vacuum home. This recreates a brand new map and stores it on the current map memory.
You will only see the current location mapped, so you will need to take him for a spin using the manual mode controls on the Xiaomi app so you can take it to every room and map all of it. After this procedure is done, return home and you will have a base map that will not change until if you don’t change the docking station location. If the map is messed up again, just return home and run the recreate map script again.
Now you can use the FloleVac app and get all zones coordinates with the new and correct map generated. Add them to your HA project and test it.
Don’t worry if the map gets messed up, just recreate the map and the coordinates will work just like before, since your docking station is on the same position (ZERO, ZERO coordinate) the vacuum will know were to go.
Here are my configs on a single package file:
sensor:
- platform: template
sensors:
xiaomi_battery_level:
entity_id: vacuum.aspirador
friendly_name: 'Bateria do aspirador'
value_template: '{{ states.vacuum.aspirador.attributes.battery_level | float | int }}'
unit_of_measurement: '%'
device_class: battery
switch:
- platform: template
switches:
aspirador:
friendly_name: "Aspirador"
value_template: "{% if is_state('vacuum.aspirador', 'cleaning') %}on{% else %}off{% endif %}"
turn_on:
service: input_select.select_option
entity_id: input_select.zonas_de_aspiracao
data_template:
option: "Casa toda"
turn_off:
service: vacuum.return_to_base
data:
entity_id: vacuum.aspirador
icon_template: mdi:robot-vacuum
input_select:
estados_de_succao:
name: 'Tipo de aspiração'
initial: Balanceado
options:
- Silencioso
- Balanceado
- Turbo
- Turbo máximo
- Pano úmido
zonas_de_aspiracao:
name: Qual a zona a aspirar?
options:
- Escolher zona
- Casa toda
- Sala inteira
- Tapete
- Mesa de jantar
- Entrada
- Cozinha
- Banheiro social
- Banheiro da suíte
- Quarto
- Suite
- Suíte mais banheiro
- Quartos e banheiros
- Somente piso
automation:
#Coloca o aspirador em modo silencioso
- alias: Aspirador - Modo de aspiração
trigger:
platform: state
entity_id: input_select.estados_de_succao
action:
- service_template: >
{% if trigger.to_state.state == 'Silencioso' %}
script.aspirador_set_quiet
{% elif trigger.to_state.state == 'Balanceado' %}
script.aspirador_set_balanced
{% elif trigger.to_state.state == 'Turbo' %}
script.aspirador_set_turbo
{% elif trigger.to_state.state == 'Turbo máximo' %}
script.aspirador_set_max
{% elif trigger.to_state.state == 'Pano úmido' %}
script.aspirador_set_mop
{% endif %}
#Escolher a zona a aspirar
- alias: Aspirador - Escolher a zona para aspirar
hide_entity: True
trigger:
platform: state
entity_id: input_select.zonas_de_aspiracao
from: 'Escolher zona'
action:
- service_template: >
{% if states.input_select.zonas_de_aspiracao.state == "Casa toda" %}
script.aspirador_zona_casa_toda
{% elif states.input_select.zonas_de_aspiracao.state == "Sala inteira" %}
script.aspirador_zona_sala_inteira
{% elif states.input_select.zonas_de_aspiracao.state == "Tapete" %}
script.aspirador_zona_tapete
{% elif states.input_select.zonas_de_aspiracao.state == "Mesa de jantar" %}
script.aspirador_zona_mesa_jantar
{% elif states.input_select.zonas_de_aspiracao.state == "Entrada" %}
script.aspirador_zona_entrada
{% elif states.input_select.zonas_de_aspiracao.state == "Cozinha" %}
script.aspirador_zona_cozinha
{% elif states.input_select.zonas_de_aspiracao.state == "Banheiro social" %}
script.aspirador_zona_banheiro_social
{% elif states.input_select.zonas_de_aspiracao.state == "Banheiro da suíte" %}
script.aspirador_zona_banheiro_suite
{% elif states.input_select.zonas_de_aspiracao.state == "Quarto" %}
script.aspirador_zona_quarto
{% elif states.input_select.zonas_de_aspiracao.state == "Suite" %}
script.aspirador_zona_suite
{% elif states.input_select.zonas_de_aspiracao.state == "Suíte mais banheiro" %}
script.aspirador_zona_suite_e_banheiro
{% elif states.input_select.zonas_de_aspiracao.state == "Quartos e banheiros" %}
script.aspirador_zona_quartos_e_banheiros
{% elif states.input_select.zonas_de_aspiracao.state == "Somente piso" %}
script.aspirador_zona_mop
{% else %}
{% endif %}
- delay: 00:01:00
- wait_template: "{{is_state('vacuum.aspirador', 'docked')}}"
- delay: 00:00:15
- service: input_select.select_option
entity_id: input_select.zonas_de_aspiracao
data_template:
option: "Escolher zona"
- service: input_select.select_option
entity_id: input_select.estados_de_succao
data_template:
option: "Turbo"
- alias: Aspirador - Avisar quando terminar
initial_state: True
trigger:
- platform: state
entity_id: vacuum.aspirador
to: 'paused'
for:
hours: 0
minutes: 0
seconds: 30
- platform: state
entity_id: vacuum.aspirador
to: 'docked'
- platform: state
entity_id: vacuum.aspirador
to: 'error'
action:
- service_template: >
{% if trigger.to_state.state == 'paused' %}
script.aspirador_alerta_parado
{% elif trigger.to_state.state == 'docked' %}
script.aspirador_alerta_carregando
{% elif trigger.to_state.state == 'error' %}
script.aspirador_alerta_erro
{% endif %}
script:
aspirador_set_quiet:
sequence:
service: vacuum.set_fan_speed
data:
entity_id: vacuum.aspirador
fan_speed: Quiet
aspirador_set_balanced:
sequence:
service: vacuum.set_fan_speed
data:
entity_id: vacuum.aspirador
fan_speed: Balanced
aspirador_set_turbo:
sequence:
service: vacuum.set_fan_speed
data:
entity_id: vacuum.aspirador
fan_speed: Turbo
aspirador_set_max:
sequence:
service: vacuum.set_fan_speed
data:
entity_id: vacuum.aspirador
fan_speed: Max
aspirador_set_mop:
sequence:
service: vacuum.set_fan_speed
data:
entity_id: vacuum.aspirador
fan_speed: 105
# Zonas
aspirador_zona_casa_toda:
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.aspirador
command: app_zoned_clean
params: [[17327,20045,27427,32995,1]]
- service: script.aspirador_alerta_iniciando
aspirador_zona_sala_inteira:
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.aspirador
command: app_zoned_clean
params: [[23745,21949,25745,31299,1],[22491,25343,23741,27643,1]]
- service: script.aspirador_alerta_iniciando
aspirador_zona_tapete:
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.aspirador
command: app_zoned_clean
params: [[23804,23551,25004,25301,2]]
- service: script.aspirador_alerta_iniciando
aspirador_zona_mesa_jantar:
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.aspirador
command: app_zoned_clean
params: [[23573,26400,25823,28850,1]]
- service: script.aspirador_alerta_iniciando
aspirador_zona_entrada:
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.aspirador
command: app_zoned_clean
params: [[23620,28957,24920,31307,1]]
- service: script.aspirador_alerta_iniciando
aspirador_zona_cozinha:
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.aspirador
command: app_zoned_clean
params: [[18839,29577,23689,31177,1]]
- service: script.aspirador_alerta_iniciando
aspirador_zona_banheiro_social:
sequence:
- service: input_select.select_option
entity_id: input_select.estados_de_succao
data:
option: Turbo
- service: vacuum.send_command
data:
entity_id: vacuum.aspirador
command: app_zoned_clean
params: [[18885,25636,21185,26786,1]]
- service: script.aspirador_alerta_iniciando
aspirador_zona_banheiro_suite:
sequence:
- service: input_select.select_option
entity_id: input_select.estados_de_succao
data:
option: Turbo
- service: vacuum.send_command
data:
entity_id: vacuum.aspirador
command: app_zoned_clean
params: [[18815,24240,21115,25390,1]]
- service: script.aspirador_alerta_iniciando
aspirador_zona_quarto:
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.aspirador
command: app_zoned_clean
params: [[18484,27011,21984,29461,1]]
- service: script.aspirador_alerta_iniciando
aspirador_zona_suite:
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.aspirador
command: app_zoned_clean
params: [[18931,21286,22581,23936,1],[21250,23964,22100,25464,1]]
- service: script.aspirador_alerta_iniciando
aspirador_zona_suite_e_banheiro:
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.aspirador
command: app_zoned_clean
params: [[18897,21234,22497,25434,1]]
- service: script.aspirador_alerta_iniciando
aspirador_zona_quartos_e_banheiros:
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.aspirador
command: app_zoned_clean
params: [[18554,21238,22454,29338,1]]
- service: script.aspirador_alerta_iniciando
aspirador_zona_mop:
sequence:
- service: input_select.select_option
entity_id: input_select.estados_de_succao
data:
option: Pano úmido
- service: vacuum.send_command
data:
entity_id: vacuum.aspirador
command: app_zoned_clean
params: [[18554,21238,22454,29338,1],[22528,25448,25878,27598,1],[25164,22181,25814,25431,1],[18854,29557,24854,31407,1],[23607,27587,25857,29537,1]]
- service: script.aspirador_alerta_iniciando
aspirador_voltar_dock:
alias: Aspirador casa - Parar e voltar
sequence:
- service: vacuum.return_to_dock
entity_id: vacuum.aspirador
# Alertas
aspirador_alerta_iniciando:
alias: Aspirador casa - Iniciando
sequence:
- service: notify.TUDO
data_template:
title: "Alerta Casa"
message: "O aspirador iniciou a limpeza na zona: {{ states.input_select.zonas_de_aspiracao.state | lower }}."
- service: persistent_notification.create
data:
title: "Alerta Casa ({{now().strftime('%H:%M')}})"
message: "O aspirador iniciou a limpeza na zona: {{ states.input_select.zonas_de_aspiracao.state | lower }}"
- condition: state
entity_id: input_boolean.boa_noite
state: 'off'
- service: media_player.volume_set
entity_id: media_player.sala, media_player.suite
data:
volume_level: 0.7
- service: tts.amazon_polly_say
entity_id: media_player.sala, media_player.suite
data_template:
message: <speak><amazon:auto-breaths frequency='medium'>E lá vai ele... Iniciando a limpeza na zona {{ states.input_select.zonas_de_aspiracao.state | lower }}.</amazon:auto-breaths></speak>
aspirador_alerta_parado:
alias: Aspirador casa - Parado
sequence:
- service: notify.TUDO
data_template:
title: "Alerta Casa"
message: "O aspirador parou. Estava limpando a zona: {{ states.input_select.zonas_de_aspiracao.state | lower }}. {% if 'error' in states.vacuum.aspirador.state %}Código de erro: {{ states.vacuum.aspirador.attributes.error }}.{% else %}{% endif %}"
- service: persistent_notification.create
data:
title: "Alerta Casa ({{now().strftime('%H:%M')}})"
message: "O aspirador parou. Estava limpando a zona: {{ states.input_select.zonas_de_aspiracao.state | lower }}. {% if 'error' in states.vacuum.aspirador.state %}Código de erro: {{ states.vacuum.aspirador.attributes.error }}.{% else %}{% endif %}"
- condition: state
entity_id: input_boolean.boa_noite
state: 'off'
- service: media_player.volume_set
entity_id: media_player.sala, media_player.suite
data:
volume_level: 0.7
- service: tts.amazon_polly_say
entity_id: media_player.sala, media_player.suite
data_template:
message: <speak><amazon:auto-breaths frequency='medium'>O aspirador parou limpando a zona {{ states.input_select.zonas_de_aspiracao.state | lower }}. {% if 'error' in states.vacuum.aspirador.state %}Código de erro é {{ states.vacuum.aspirador.attributes.error }}.{% else %}{% endif %}</amazon:auto-breaths></speak>
aspirador_alerta_carregando:
alias: Aspirador casa - Voltou para casa
sequence:
- condition: template
value_template: "{% if is_state('input_select.zonas_de_aspiracao', 'Escolher zona') %}False{% else %}True{% endif %}"
- service: notify.TUDO
data_template:
title: "Alerta Casa"
message: "O aspirador terminou seu trabalho na zona {{ states.input_select.zonas_de_aspiracao.state | lower }}. Limpou cerca de {{ states.vacuum.aspirador.attributes.cleaned_area }} metros quadrados durante {{ states.vacuum.aspirador.attributes.cleaning_time }} minutos e está carregando no momento."
- service: persistent_notification.create
data:
title: "Alerta Casa ({{now().strftime('%H:%M')}})"
message: "O aspirador terminou seu trabalho na zona {{ states.input_select.zonas_de_aspiracao.state | lower }}. Limpou cerca de {{ states.vacuum.aspirador.attributes.cleaned_area }} metros quadrados durante {{ states.vacuum.aspirador.attributes.cleaning_time }} minutos e está carregando no momento."
- condition: state
entity_id: input_boolean.boa_noite
state: 'off'
- service: media_player.volume_set
entity_id: media_player.sala, media_player.suite
data:
volume_level: 0.7
- service: tts.amazon_polly_say
entity_id: media_player.sala, media_player.suite
data_template:
message: <speak><amazon:auto-breaths frequency='medium'>Olha quem está de volta! O aspirador terminou seu trabalho na zona {{ states.input_select.zonas_de_aspiracao.state | lower }}. Limpou cerca de {{ states.vacuum.aspirador.attributes.cleaned_area }} metros quadrados durante {{ states.vacuum.aspirador.attributes.cleaning_time }} minutos e está carregando no momento.</amazon:auto-breaths></speak>
aspirador_alerta_erro:
alias: Aspirador casa - Erro
sequence:
- service: notify.TUDO
data_template:
title: "Alerta Casa"
message: "O aspirador está parado e acusou erro limpando a zona {{ states.input_select.zonas_de_aspiracao.state | lower }}."
- service: persistent_notification.create
data:
title: "Alerta Casa ({{now().strftime('%H:%M')}})"
message: "O aspirador está parado e acusou erro limpando a zona {{ states.input_select.zonas_de_aspiracao.state | lower }}."
- condition: state
entity_id: input_boolean.boa_noite
state: 'off'
- service: media_player.volume_set
entity_id: media_player.sala, media_player.suite
data:
volume_level: 0.7
- service: media_player.play_media
data:
entity_id: media_player.sala, media_player.suite
media_content_id: 'https://DDNS/local/audio/tts/alerta_aspirador_parado_erro.mp3'
media_content_type: 'audio/mp3'
# HomeKit scripts
aspirador_homekit_zona_toda_casa:
alias: Aspirador casa - Aspirar zona casa toda
sequence:
- service: input_select.select_option
entity_id: input_select.zonas_de_aspiracao
data_template:
option: "Casa toda"
- delay: 00:00:10
aspirador_homekit_zona_sala:
alias: Aspirador casa - Aspirar zona sala inteira
sequence:
- service: input_select.select_option
entity_id: input_select.zonas_de_aspiracao
data_template:
option: "Sala inteira"
- delay: 00:00:10
aspirador_homekit_zona_mesa_jantar:
alias: Aspirador casa - Aspirar zona mesa de jantar
sequence:
- service: input_select.select_option
entity_id: input_select.zonas_de_aspiracao
data_template:
option: "Mesa de jantar"
- delay: 00:00:10
aspirador_homekit_zona_tapete:
alias: Aspirador casa - Aspirar zona tapete
sequence:
- service: input_select.select_option
entity_id: input_select.zonas_de_aspiracao
data_template:
option: "Tapete"
- delay: 00:00:10
aspirador_homekit_zona_entrada:
alias: Aspirador casa - Aspirar zona entrada
sequence:
- service: input_select.select_option
entity_id: input_select.zonas_de_aspiracao
data_template:
option: "Entrada"
- delay: 00:00:10
aspirador_homekit_zona_cozinha:
alias: Aspirador casa - Aspirar zona cozinha
sequence:
- service: input_select.select_option
entity_id: input_select.zonas_de_aspiracao
data_template:
option: "Cozinha"
- delay: 00:00:10
aspirador_homekit_zona_quartos:
alias: Aspirador casa - Aspirar zona quartos e banheiros
sequence:
- service: input_select.select_option
entity_id: input_select.zonas_de_aspiracao
data_template:
option: "Quartos e banheiros"
- delay: 00:00:10
aspirador_homekit_zona_mop:
alias: Aspirador casa - Aspirar zona somente piso
sequence:
- service: input_select.select_option
entity_id: input_select.zonas_de_aspiracao
data_template:
option: "Somente piso"
- delay: 00:00:10
# Outros
aspirador_recriar_mapa:
alias: Aspirador casa - Recriar mapa
sequence:
- service: vacuum.start
entity_id: vacuum.aspirador
- delay: 00:00:08
- service: vacuum.stop
entity_id: vacuum.aspirador
- delay: 00:00:02
- service: vacuum.return_to_base
entity_id: vacuum.aspirador
# Customize
homeassistant:
customize:
switch.aspirador:
icon: mdi:robot-vacuum
input_select.estados_de_succao:
icon: mdi:speedometer
input_select.zonas_de_aspiracao:
icon: mdi:map-marker
input_number.aspirador_passadas:
icon: mdi:shuffle-disabled
script.aspirador_recriar_mapa:
icon: mdi:home-map-marker
This is my current UI:
Here is the lovelace config:
- type: entities
title: Aspirador
show_header_toggle: false
entities:
- entity: vacuum.aspirador
secondary_info: last-changed
- sensor.xiaomi_battery_level
- entity: script.aspirador_recriar_mapa
name: Recriar mapa
- input_select.estados_de_succao
- input_select.zonas_de_aspiracao
- type: custom:entity-attributes-card
entity: vacuum.aspirador
heading_name: Status
heading_state: Valor
filter:
include:
- key: vacuum.aspirador.cleaning_time
name: Tempo limpando (último)
unit: minutos
- key: vacuum.aspirador.cleaned_area
name: Área limpa (último)
unit: metros
- key: vacuum.aspirador.main_brush_left
name: Escova principal
unit: horas
- key: vacuum.aspirador.side_brush_left
name: Escova lateral
unit: horas
- key: vacuum.aspirador.filter_left
name: Filtro
unit: horas
- key: vacuum.aspirador.sensor_dirty_left
name: Sensores
unit: horas
It has been months now without any problems with zone cleaning. If I need to clean it up by removing the vacuum manually from the dock, I just need to recreate the map using the script and all works just fine.
And yes, some of these scripts has more than one zone on the same command, works just fine.
Sorry that everything is in portuguese, I hope you can understand the main idea here.
Hope it helps!
Try with this:
'{{ ("[[30914,26007,35514,28807" + "," + (states("input_number.vacuum_passes") | int | string + "]]") )}}'
vacuum_cucina:
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.xiaomi_vacuum
command: app_zoned_clean
params: '{{ ("[[30914,26007,35514,28807" + "," + (states("input_number.vacuum_passes") | int | string + "]]") )}}'
- service: script.vacuum_alert_start
Hi @Schneider,
thanks again for your great post, it helped me a lot.
I was trying to test your notify part (notify tudo). It wasn’t on your code posted.
Could you kindly share with me ?
Many thanks !
And ,do you know if it’s possible to activate the carpet mode? Or it’s activated by default ?
Hello sir! I am glad I could help you!
No worries. This notify part is a “notify group” that I’ve created to send a message to a few devices (all mobile phones, Google Home Minis, TVs, and so on), you can set they way you want to be notified with your setup.
The carpet mode is activated automatically but I suggest you set the vacuum power to max anyways if you had created a zone that contains only your carpet.
Another great tip is that fan_speed
105 sets the vacuum in to MOP mode, you can check on your mobile app that the mopping mode is selected.
Let me know if you need anything else.
Good luck!
Hi Schneider! Good news I found a valetudo branch with clickable zoned cleaning .I compiled this piece of software and will test and report … then it should be possible to select zoned cleaning within a map . But u need complete map before which includes full clean and don’t carry your robot around I’ll report tomorrow if it works well
Amazing stuff mate! Good luck!
Tested the new feature.it seems to work but still in beta.as soon as there was a cleanup of the code and integration in valetudo I’ll make a post here
Hi, I’m right, that you’re all using Valetudo?
For me the zoned cleaning via hass.io isn’t working at all. I have the following script for example:
vacuum_wohnzimmer: alias: Wohnzimmer saugen sequence: - service: vacuum.send_command data: entity_id: vacuum.roborock command: app_zoned_clean params: [22250,27500,29400,25000,1]
When I run it the vacuum says “starting zone cleaner”, boosts up, than without driving says “finished zone cleaning going back to dock.”
If I’m using Valetudos new Zone Website it works perfectly…
Does anybody has an idea?
Btw: Goto works great.
vacuumgoto: alias: Vacuum go to sequence: - service: vacuum.send_command data: entity_id: vacuum.roborock command: app_goto_target params: [29300, 27300]
Found my issues…
params have to be
params: [[22250,27500,29400,25000,1]]
and on my other script i typed
service: vacuum.send_command
data_template:
Which has to be “data”. If one of this typos are in the script the roborock seems to start cleaning, but the values aren’t right, so it cancels then.
I submit a pull request with a new service xiaomi_clean_zone_start
Download this file xiaomi_miio.py and put it in /custom_components/vacuum until my pull request will be approved.
Example of use with automation:
- id: '1546608481220'
alias: Test vacuum zone
trigger:
- event: start
platform: homeassistant
condition: []
action:
- data:
entity_id: vacuum.xiaomi_vacuum
reps: 3
zone: [[23510,25311,25110,26361]]
service: vacuum.xiaomi_clean_zone_start
Here my github pull request: https://github.com/home-assistant/home-assistant/pull/19777
Is this working for you? Just seen, that you tried to set the value using a template, which I’m trying to do with my vacuum since 2 days for setting the volume.
When I’m inserting my input_number into your script like this:
action:
- service: vacuum.send_command
data_template:
entity_id: vacuum.roborock
command: change_sound_volume
params: '{{ ("[" + (states("input_number.vacuum_volume") | int | string + "]") )}}'
Still nothing happens. Currently my guess is, that the „vacuum.send_command“ doesn’t support data_template, as not even „params: [10]“ or similar is working is working then…
Thank’s for your job! Works like a charm!
PS. For those who will use this component
warning: do not confuse date: and data_template:
If you use variables you must always put data: as examples here: https://github.com/home-assistant/home-assistant/pull/19777
Does this allow you to resume a zoned cleanup? If it gets stuck, errors, or paused?
I never tried It…
Is your PR with xiaomi_clean_zone_start also supporting zones as templates?
Currently I had to create 8 scripts to clean every single room. Adding input_booleans for each of them and then run a script mentioned in the “Howto: Xiaomi vacuum zoned cleaning” to run the scripts that are having activated input_booleans.
If the xiaomi_clean_zone_start supports also zones as templates I could include them as a list when calling the cleaning script and and short my scripts by 1/8.
Greets
No… in this moment you can only use repeats as template.
Okay, would it be possible by home assistant design to use templates in zone, too?
after PR is approved, I will work on it