Howto: Xiaomi vacuum zoned cleaning

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.

I have this from time to time as well. You need to make sure that if the zone is a room with a door, that the zone includes some of the area outside of the room in front of the door. The reason for this is that if the last time an adjacent zone was clean and the door to the zone in question was closed, the vacuum updates the map and shows no opening there. So, it struggles to find a place to start the next time you call it, if the zone is behind the doorway… the map will show no opening in order to get into that zone.

1 Like

I have this after I have moved it upstairs and cleaned, then returned to dock. The 1st command always moves 1ft them back to dock. Next command works as it shoud

I hope some one can help me with these questions:

  1. To show the map in Home Assistant my Xiaomi Vacuum needs to be rooted as I’ve read. But how does the FloleVac app get the map? That’s not requiring a rooted vacuum. Can’t we use the same method in Home Assistant?
  2. I’m using “app_goto_target” but when I use the vacuum upstairs and move it back the startpoint is different and the coordinates used are no longer the same. Can I somehow reset the starting point or get the current coordinates so I can just sum up from those?

Hi, I am having the same problem,
I had the legacy API key working, but for a while now this is no longer working anymore, I get a 401 error

http://mydomainnamehere:8123/api/services/script/clean_kitchen?api_password=legacy_api_key_here
My script looks like this:
{ "command": "app_zoned_clean", "entity_id": "vacuum.xiaomi_vacuum_cleaner", "params": [ [ 25330, 21500, 30100, 27500, 1 ] ] }

I can execute this fine from HASS, but it no longer works from IFTTT
Any ideas on how to pass the new authentication methods specifically the access token key?

why do you want IFTTT? for google assistant? why not use then the google assistant component from HA?
anyway, dont use the API token anymore, switch over to the bearer token

This also happens in a “clean hallway” scenario, which is where the vacuum dock is, no doors blocking its way

Where can we find the dustcloud discord server? I searched everywhere :slight_smile:

I’m having the same issue Fixx mentioned in here. Basically it works fine if I zone clean through the app, but if I send a command via home assistant it drives around for awhile, says cleaning is complete with some unreachable areas and returns. It doesn’t matter how simple the zone is. Here’s an example command:

{
  "command": "app_zoned_clean",
  "entity_id": "vacuum.xiaomi_vacuum_cleaner",
  "params": [
    [
      17000,
      31000,
      18500,
      28000,
      1
    ]
  ]
}

Did you figure this out?

Mine does this too. It goes out a foot, then says finished cleaning and some areas couldn’t be cleaned.

I scheduled the vacuum to clean at 4pm Monday-Friday through the Mi Home app, I’m wondering if this changes the map every day and then the coordinates I have for my “kitchen” zone have changed.

Supposedly once you record the areas you should never do a full cleanup again otherwise you can’t use those zones. The heck if I understand the logic, but I can’t expect no one will ever start the cleanup using the physical button

Zoned cleanup was also not working well in my case, what I’ve done is used “go to” and then “spot cleanup”. To avoid the coordinates from changing every time I’m resetting the map by starting and stopping a cleanup for 2 seconds before running commands, see: https://github.com/royduin/home-assistant-config/blob/c57aeb191520f452794b9ff3def3b81af5f580c6/scripts.yaml#L40:L61

Interesting, from 88.0 we are going to have the pause command :wink:

Yeah, I had that problem too. In my case I hade it under the sofa so it started, made some noice, and stopped zone cleanup. My solution was to add a “pre-zone” to the command that it first did thats 0 with but 2 m long starting by the dock and ending outside the sofa. Kinda like this:

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

So for my bedroom command I have 3 zones in the command:

vacuum_bedroom:

  alias: "Vacuum the bedroom"
  sequence:
    - service: vacuum.send_command
      data:
        entity_id: vacuum.Bellman
        command: app_zoned_clean
        params: [[25500,25500,25500,27000,1], [24300,32000,28800,35100,1], [23000,34300,24300,35100,1]]

This makes it do an “extra” turn around that line from the dock under the sofa and out from it, but thats no big deal. I´ll just say it does a ritual dance if soemone asks :stuck_out_tongue:

Aha, this is interesting…I sometimes take that vacuum to another floor, then later I need todo a clean map again before I can send him in a zone…

So what I can do in my automation, first send him to some point, thenndo a zone clean…
So then I never have a lost map