Howto: Xiaomi vacuum zoned cleaning

I’m aware and I do have multiple zones called in a single zone clean command. However, my situation is not that simple.

I have a large house with 18 zones and some of the occupants of the house are retirees and are at home most of the day and don’t awaken until 8:30 - 9:00. I start the vacuuming (using multiple zones in params) at 7:30 at the side of the house that becomes unoccupied by that time. The vac is done with those zones by 8:30 and then goes to the carpet on the opposite side of the house, en-route it traverses a large tiled area but I don’t want it to vacuum there yet because the noise of it going over the grout lines is too noisy for occupants that may still be asleep in nearby bedrooms. After doing that carpet, I have it going back to the tiled areas.

So in essence I need to call at least 3 “app_zoned_clean” commands with different params arrays. But between each command it has to re-dock for the next “app_zoned_clean” command to be able to fire, as I’ve learned that it can only fire if the vac is in a docked or idle state. I decided to take advantage of the re-docking and when it re-docks my automation checks the battery level and waits until it hits a certain threshold before firing the next zone clean command.

I tested a bit more and it doesn’t work even with single area specified. I draw same area in the Mi Home app and it cleaned the team without any issue.

  1. Did you try the last script with

params: {{ zones }}

instead of

params: '{{ zones }}'

  1. and did you try to pause the vacuum after cleaning and than start the next zone?

Yes I have tried both.

  1. The problem is that data_template is not working, even if I don’t use variables. So it does not even matter if I put the ’ or not.
  2. Yes I did try to pause/stop the vacuum on the way back to the dock, but it did not work. While the pause function does work while cleaning, it does not work when the vacuum is returning to the dock. If you know a way to make this work, I would love to use it.

I also had that problem, when I gave an illegal parameter to the app_zoned_clean command. For example it seems to be important that the params are not a string, so you should not use “” or ‘’. Furthermore it seems that you are not allowed to use data_template. This will also result in that behavior.

Try to compare your yaml exactly to the example from the first post:

vacuum_kitchen:
      alias: "Vacuum the kitchen"
      sequence:
        - service: vacuum.send_command
          data:
            entity_id: vacuum.DustyMcDustface
            command: app_zoned_clean
            params: [[26500, 20500, 29000, 23000, 1]]

try this Zone cleaning parameters - Xiaomi vacuum
Add zone and reps for Xiaomi vacuum #19777

1 Like

The same. Nothing happens. Is anyone able the to send roborock via app_goto_target?

The multiple zoned cleaning is working via NodeRED.

Do not use " around those params like this:

"params": [[25124,24170,29824,28870,1]]

Same here.
Can not use “app_zoned_clean” because of changing coordinates.
My robot drives into an other rom every time the map is new created
or driving a few seconds backward and hang up on charging station…

Does anyone have a solution for this ?

Never do a CLEAN map, otherwise the map is deleted… Always use zone cleaning, also for a full house cleaning

@Dielee

Just to add to this. Make sure you have the latest firmware installed so that you can save the map.

However, that being said… I recently did a restore on my vacuum and reloaded the firmware, this of course caused it to lose the saved map, but I ran the zone clean commands using the coordinates from before the restore and it proceeded to make a new map as it correctly cleaned the zones. The key to this I believe is: 1) do not move the charging base; it needs to always be the same starting point, 2) make sure the charging base has the proper space around it; the manual states it must be against a wall, with 1.5 feet of empty space on either side and 4 feet of space in front of it. Before I properly situated it, I had trouble with it navigating correctly. It would be unsure of it’s starting location and even get lost when moving to a new zone. After situating it as per the manual, those issues disappeared.

1 Like

Thank you @e1miran!

I changed the location of my dock and it’s working now !
It had not enough space to both sides.

If someone searching for code and have the same problem…

Do not make a “Clean” in MiHome app.
Use zoned cleanup and clean all zones in one script if you want to clean the whole house.

I using this:

scripts.yaml

  alles_saugen:
    sequence:
      - service: vacuum.send_command
        data:
          entity_id: vacuum.xiaomi
          command: app_zoned_clean
          params: [[22327,22376,26877,26826,1],[26940,25726,29990,26826,1],[25786,26860,27886,30410,1],[28126,26794,29976,30394,1],[27634,24133,30834,25733,1]]

  kinderzimmer_saugen:
    sequence:
      - service: vacuum.send_command
        data:
          entity_id: vacuum.xiaomi
          command: app_zoned_clean
          params: [[23264,27007,25314,30357,1]]

  badezimmer_saugen:
    sequence:
      - service: vacuum.send_command
        data:
          entity_id: vacuum.xiaomi
          command: app_zoned_clean
          params: [[28126,26794,29976,30394,1]]

  wohnzimmer_saugen:
    sequence:
      - service: vacuum.send_command
        data:
          entity_id: vacuum.xiaomi
          command: app_zoned_clean
          params: [[22327,22376,26877,26826,1]]

  flur_saugen:
    sequence:
      - service: vacuum.send_command
        data:
          entity_id: vacuum.xiaomi
          command: app_zoned_clean
          params: [[26940,25726,29990,26826,1]]

  kuche_saugen:
    sequence:
      - service: vacuum.send_command
        data:
          entity_id: vacuum.xiaomi
          command: app_zoned_clean
          params: [[25786,26860,27886,30410,2]]

Thanks all!

Hello…

This works perfectly and I love the new “toy” but how do I stop the map getting wiped when I move the vacuum upstairs to clean please? It is a right pain in the …

Cheers
Mark

I don’t think you can. They’d need to add capability to create and deal with multiple maps. Your only other solution is a second vac, unfortunately.

Or wait for further updates… Fingers crossed

Hi!

I´ve gotten this to work. In the configuration.yaml file I have added these codes thats more than standard install:

http:
  api_password: my-code
  base_url: https://my-domain.duckdns.org:8123
  ssl_certificate: /ssl/fullchain.pem
  ssl_key: /ssl/privkey.pem

panel_iframe:
  configurator:
    title: Configurator
    icon: mdi:wrench
    url: https://my-domain.duckdns.org:3218
    
vacuum:
  - platform: xiaomi_miio
    host: my-vacuum_ip
    token: my-token
    name: Bellman
    
ifttt:
  key: my-key

In the scripts.yaml I have these codes:

vacuum_kitchen:
      alias: "Vacuum the kitchen"
      sequence:
        - service: vacuum.send_command
          data:
            entity_id: vacuum.Bellman
            command: app_zoned_clean
            params: [[25300,29300,28800,32000,1]]

vacuum_livingroom:
      alias: "Vacuum the living room"
      sequence:
        - service: vacuum.send_command
          data:
            entity_id: vacuum.Bellman
            command: app_zoned_clean
            params: [[22800,25100,27700,28600,1]]

vacuum_hallway:
      alias: "Vacuum the hallway"
      sequence:
        - service: vacuum.send_command
          data:
            entity_id: vacuum.Bellman
            command: app_zoned_clean
            params: [[22600,28600,25300,32000,1]]

vacuum_bathroom:
      alias: "Vacuum the bathroom"
      sequence:
        - service: vacuum.send_command
          data:
            entity_id: vacuum.Bellman
            command: app_zoned_clean
            params: [[22600,32100,24300,33800,1]]

vacuum_bedroom:
      alias: "Vacuum the bedroom"
      sequence:
        - service: vacuum.send_command
          data:
            entity_id: vacuum.Bellman
            command: app_zoned_clean
            params: [[24300,32000,28800,35100,1], [23000,34300,24300,35100,1]]
            
vacuum_empty:
      alias: "Move to empty the bin"
      sequence:
        - service: vacuum.send_command
          data:
            entity_id: vacuum.Bellman
            command: app_goto_target
            params: [25500,27300]

vacuum_return:
      alias: "Return to dock"
      sequence:
        - service: vacuum.return_to_base
          data:
            entity_id: vacuum.Bellman
            
vacuum_start:
      alias: "Vacuum the home"
      sequence:
        - service: vacuum.start
          data:
            entity_id: vacuum.Bellman

vacuum_stop:
      alias: "Stop vacuum"
      sequence:
        - service: vacuum.stop
          data:
            entity_id: vacuum.Bellman

In the ifttt i have this under url:
https://my-domain.duckdns.org:8123/api/services/script/vacuum_bedroom?api_password=my-code
Method post, content type text/plain and body is empty.

I have configurator, duck dns and samba upp and running correctly too.

However I can NOT get the “new way” to work:


That means calling a script with the hassio url for webhook and with this code in automations:
-alias: "Execute IFTTT commands"
  trigger:
    platform: event
    event_type: ifttt_webhook_received
    event_data:
      action: call_service
  action:
    service_template: '{{ trigger.event.data.service }}'
    data_template:
      entity_id: '{{ trigger.event.data.entity_id }}'

And then this in the webhooks body:
{ “action”: “call_service”, “service”: “script.turn_on”, “entity_id”: “script.clean_bedroom” }

The automation code “bricks” the hassio so I cant log in through the web interface so I need the remove it with samba and then pull the cord.

i’ve been having a weird time with zoned cleanup. i mapped all my room coordinates into scripts, and tested each to see the map on the app clearly show the correct areas marked when running each script. After a few days though when i ran these scripts again the vacuum will move for a few seconds and then immediately declare finished cleaning and go back to the dock.

not sure if its related to a firmware update. anyone got any ideas?

When I lost the map then I make a “challenge” in the rooms with my vaccum with remote control mode in the app. It takes a few minutes and I get back the full map. The dock is in same position allways therefore the coordinate of the rooms remains valid.

The using of templates can be bypassed with NodeRED flows. I’m newbie at NodRED (also in Hassio :grinning:) but the multiple zoned automation is working quite good, I’d say on 95%. It means that the changing between the rooms is not too fluid because I have to make a 15 sec delay between the changes because of the delays of vaccum messages.
But at least it is working for me with simple input booleans and scripts.