Howto: Xiaomi vacuum zoned cleaning

Has anyone experienced issues recently after the Mi Home app updated on iOS about a week ago? Mine constantly gets confused and even attempts to redraw maps on zone cleans, even though the map is set to be saved. Zone cleans have been unstable after having run well for months.

For my vacuum, it seems like the starting coordinates changed. It’s no longer 25500,25500 for some strange reason. It’s almost more like 28000,26250? Don’t know if that helps, but I had to correct all my zones. It’s quite a pain especially if you’ve mapped out everything nicely!

This occasionally happens to mine. If it scanned a closed door on a previous clean it assumes a wall, and tries to map an alternative route.
Assuming this is what it is doing (you can tell by looking in the Xiaomi app), there are two fixes:

  1. Manually use the ‘go to’ function and send it just in front of the door. It should rescan and realise the door is open. Or:
  2. Pick up the vacuum and place it in the room you want cleaned. If it has previously mapped that room, when you commence cleaning it will spin, realise where it is, and clean. It will also realise the door is now open and return to the dock.
1 Like

@wporchard Did you replace the charger to a different spot?

No I didn’t. But I just did a remap of my house and the coordinates start at 25500, 25500 again!

For the GOOGLE lovers among us , @giefca was verry kind to extend this google trait:
https://developers.google.com/actions/smarthome/traits/startstop

it has the possiblity todo zone cleaning
so now we expose the vacuum and say
Hey google , vacuum the kitchen!

how to use (for now)
load google assistant as a custom component, and replace the file below

in that .py file manually change the name + coordinates:

line 491 + 492 , or if you want more zones, just change it

                    'kitchen': [14600,17800,20450,21700],
                    'living room': [25480,17400,29530,22250],

Notes:

  • this only works, with google_assistant local not nabu casa, sine i dont dont think we can override nabucasa, let me know if otherwise
  • this is static repeats to 1 , not sure if this is supported on google trait anyway

so , now expose only the vacuum, not needed anymore to expose scripts ot whatever to do zone cleaning anymore!!

thnx again @giefca

Can someone tell me why my script doesn’t work? The robot starts cleaning and directly going back to dock. When I call the service directly, it works fine.

configuration.yaml

input_select:
  vacuum_zones:
    name: Bereich auswählen
    initial: Esstisch
    options:
      - Esstisch
      - Wohnbereich
      - Küche/Flur/Bad
      - Küche
      - Flur
      - Badezimmer

scripts.yaml

start_zoned_cleanup:
  alias: Start zoned cleanup
  sequence:
  - data_template:
      entity_id: vacuum.bruno
      command: app_zoned_clean
      params: >
        {% if is_state("input_select.vacuum_zones", "Wohnbereich") %}
          [[25500,19750,29250,25500,1]]
        {% elif is_state("input_select.vacuum_zones", "Küche/Flur/Bad") %}
          [[30914,26007,35514,28807, 1],[30914,26007,35514,28807, 1],[30914,26007,35514,28807, 1]]
        {% elif is_state("input_select.vacuum_zones", "Küche") %}
          [[30914,26007,35514,28807, 1]]
        {% elif is_state("input_select.vacuum_zones", "Flur") %}
          [[30914,26007,35514,28807, 1]]
        {% elif is_state("input_select.vacuum_zones", "Badezimmer") %}
          [[30914,26007,35514,28807, 1]]
        {% else %}
          [[25500,24500,29750,27750,1]]
        {% endif %}
    service: vacuum.send_command

You need an automation which starts the vacuum when something is selected in the input_select dropdown. Not a script. In the automation a state change of the input_select is the trigger.

Isn’t it possible to pass the params from a template like a sensor?

start_zoned_cleanup:
alias: Start zoned cleanup
sequence:

  • data_template:
    entity_id: vacuum.bruno
    command: app_zoned_clean
    params: ‘{{ states(’‘sensor.vacuum_zoned_cleanup’‘) }}’
    service: vacuum.send_command

Regarding cleaning >5 zones in a single script, what if the wait commands check for state ‘returning’ instead of docked?

- wait_template: (is_state('vacuum.xiaomi_vacuum_cleaner', 'returning'))

According to the HA history, after a zone clean, the vacuum state changes to ‘returning’ before ‘docked’.

@zero545

Did you get this working? From what I remember, it did not respond to new zone clean commands until after docking.

I did not have the problem of waiting for the right state, but the vacuum robot did not react to any commands (not even stop) until it was back in the dock. I haven’t looked into this for a while. Did that behaviour change?

I was just speculating and wondering if someone had tried it. I tested it today and no joy.

This is consistent with its normal behaviour outside of HA, now that I think about it - it won’t take other commands unless paused, docked or stopped.

I’ll try a pause command + wait until state is returning, unless someone has tried that already?
@e1miran

You can’t use data_template with this service - data template passes a STRING not an array (it is up to the service software to parse that string properly, and the software doesn’t do that).

e.g. your params for the first condition evaluates to the STRING:
“[[25500,19750,29250,25500,1]]”
NOT the list of lists of integers data structure required:
[[25500,19750,29250,25500,1]]

see:

1 Like

Okay, no luck. Same as reported - it will commence the next zone after it has redocked.

Has anyone managed to get zone cleaning to work with IFTTT with # amounts of cleaning?
Like this guide for example https://hackernoon.com/how-i-set-up-room-cleaning-automation-with-google-home-home-assistant-and-xiaomi-vacuum-cleaner-9149e0267e6d

I have followed the guide and the google assistant responds with the correct phrase but it does not start the cleaning. The logbook says Error while executing automation automation.ifttt. Invalid data for call_service at pos 1: Service does not match format <domain>.<name>

that guide is based on old IFTTT method
i think you are using webhooks and IFTTT integration? then the commands are different

@ciB is “we cannot use lists (which the coordinates are) in templates.” that still the case ? I mean now that xiaomi_clean_zone has been added to HASS or that has nothing to do with it ? I am just trying to figure out how much is still the case so i can start making my zones.

Since the coords are still passed through the data field, this rule still applies - unless they have added that templates can actually render lists (as far as I know they still only return Strings).

Looking at the document i see they provide the coordinates on the data_template : https://www.home-assistant.io/components/vacuum.xiaomi_miio/ but i guess that still does not make a difference ?