Howto: Xiaomi vacuum zoned cleaning

Looks like it adds support for how many times the area will be cleaned via the repeats command. Also, it seems that it defines a clean structure for providing the zone coordinates instead of simply passing them as params to a command. Other than the repeats parameter, it is just some cleanup of how it is implemented.

When yo are in Flovac draw a zone, then long press go to copy the coordinates

2 Likes

any1 tried official xiaomi integration , and NOT ha?
will a start clean, then do a new map ? if yes, than its not possible to do , zones anymore from HA?

My S5 is… dumb. It’s vacuumed the house 100+ times. It knows where the walls are. I have a bathroom that is internal to the house (it has no windows and there are other rooms on all four sides of it).

If there were no walls, yes, the fastest way to the bathroom would be to enter the kitchen and go through the back wall of the kitchen and into the bathroom. But, there are walls. Yet, when I draw a box in Mi Home/Flolevac or use this Zoned Cleaning command with those coordinates, the vacuum does just that. Goes to the wall in the kitchen, spins in circles for a while, and then goes back to the dock. It can’t figure out that the bathroom door is on the other side.

If I tell it to clean the hallway in front of the bathroom first, then the bathroom, it makes it every time.

Have you experienced this? Have any tips to get around it? It happens in a few other places for me too.

I had similar issues, resetting the map fixed it though. If the pathfinding issue continues though, add to your “clean bathroom”-script that it should go to the hallway first and then start the zoned clean. You can check if the robot has actually reached the hallway by monitoring its status (changes to idle once it reached the spot in the hallway)

okay. I’ll give this a shot. I hope navigating to the hallway first isn’t required as that will make me have to rewrite the vacuum management script I’ve been working on (and testing with a room that wasn’t the bathroom, obviously).

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