Howto: Xiaomi vacuum zoned cleaning

If nothing at all is happening… then my best guess is that IFTTT is unable to reach your HA. Verify that the webhook URL you got when you set up the IFTTT integration in HA works (try to use it outside your wifi if possible).

If what you mean is that the body is blank as in "data": {} when listening for events, then my best guess is that something is not setup properly in IFTTT.

Ok I did some tests:

  • when I use this in automations.yaml:
- alias: 'ifttt integration'
  trigger:
  - event_data:
      action: call_service
    event_type: ifttt_webhook_received
    platform: event
  action:
  - data_template:
      entity_id: '{{ trigger.event.data.entity_id }}'
      command: '{{ trigger.event.data.command }}'
      params: '{{ trigger.event.data.params }}'
    service_template: '{{ trigger.event.data.service }}'

and this code in ifttt:

{ "action": "call_service", "service": "light.turn_off", "entity_id": "light.floor_lamp" }

nothing happens with the lamp but the event listener logs this:

{
    "event_type": "ifttt_webhook_received",
    "data": {
        "action": "call_service",
        "service": "light.turn_off",
        "entity_id": "light.floor_lamp",
        "webhook_id": "6bea8edc0fb6eadbddb6b2cb251350814f3cf10062a82cb351693a6dbf6ed10c"
    },
    "origin": "LOCAL",
    "time_fired": "2020-01-03T23:44:46.477551+00:00",
    "context": {
        "id": "83a45e8efe3a4ba2be09052f687edb56",
        "parent_id": null,
        "user_id": null
    }
}
  • but when I use this in automations.yaml:
- alias: 'ifttt integration'
  trigger:
  - event_data:
      action: call_service
    event_type: ifttt_webhook_received
    platform: event
  action:
  - data_template:
      entity_id: '{{ trigger.event.data.entity_id }}'
#      command: '{{ trigger.event.data.command }}'
#      params: '{{ trigger.event.data.params }}'
    service_template: '{{ trigger.event.data.service }}'

the light actually turns off but the event listener in HA still logs the same:

{
    "event_type": "ifttt_webhook_received",
    "data": {
        "action": "call_service",
        "service": "light.turn_off",
        "entity_id": "light.floor_lamp",
        "webhook_id": "6bea8edc0fb6eadbddb6b2cb251350814f3cf10062a82cb351693a6dbf6ed10c"
    },
    "origin": "LOCAL",
    "time_fired": "2020-01-03T23:47:09.757138+00:00",
    "context": {
        "id": "25c2d804cb944af5a2a83ff7aec83305",
        "parent_id": null,
        "user_id": null
    }
}

Now I, at least, know that connection between IFTTT > HASS works.

Also tried:

{ “action”: “call_service”, “service”: “vacuum.locate", "entity_id": "vacuum.rocky" }

which worked yesterday, but now it isnt working anymore. Grrrrr. Ok so this works, I used the wrong quotation marks. This works: { "action": "call_service", "service": "vacuum.locate", "entity_id": "vacuum.rocky" }

======
Ok, so now I am where you are:

Unable to send command to the vacuum: {'code': -10000, 'message': 'data for segment is not a number'}

:slight_smile:
Interesting… value number of the room works in HA when I use services in dev options.

Maybe, but MQTT is working with everything else but the vacuum.

This is the error i get:

"Call-service API error. Error Message: dictionary update sequence element #0 has length 5; 2 is required"

The S5 gets the new app update with the room mapping capabilities. It’s currently in beta, but you can use FloleVac to update to that firmware version already!

Cool. I welcome any update. Is there change log somewhere? What about multi floor support?

No published changelog anywhere as well as no multi floor support.
And i you might ask, also no secondary map e.g. for mapping only (and avoid carpet areas etc.).

But its working pretty good for me tho.

I am looking forward for a easy to follow and mainly a nice and easiely/comfortable way of using it with Home Assistant.

So far all solutions I found here did somehow work at some degree but didnt gave me a comforable way of using it manually.

Best way is a little bit of this here, a little bit of entity buttons and a little bit of Xiaomi Vacuum Interactive Map Card.

But its still not perfect (and consumed lots of hours on making it even work).

So hopefullly this new firmware/feature will give this implementaion a boost and make it easier yet increase the usability.

The problem is that segment must be passed as an array of integers, but if you use templates it is passed as a string.
You can try to use my python script that parsers the array passed as a string.

3 Likes

that’s true. Same with no-go zones… is there a way to add/remove a no-go zone via command? That’s yet another workaround for carpets e.g., but I’m still willing to go that way.

i created a simple script to clean 2 zones, for my s5 , but if i run it, it only does the first zone, not the second one? it just goes back to the dock

any idea?

vacuum_clean_house:
  alias: Clean House
  sequence:
  - service: xiaomi_miio.vacuum_clean_zone
    data_template:
      entity_id: vacuum.roborock
      repeats: 1
      zone: 
      - [25480,17400,29530,22250]      
      - [14300,17900,25800,25950]

I’m having a strange issue. I’ve setup zoned cleanup using scripts couple of days back and it was working fine but then suddenly when I invoked the service for cleaning a kitchen, the vacuum will just move couple of centimeters (says “Starting zoned cleanup”) and then will go back to the dock (same for all other zones). Then I’ve noticed that when I take the coordinates again from the flolevac app, they are somehow different. So I’ve changed them accordingly in the scripts again but after a couple of days same thing happened. Anybody else having similar issue?

It seems like your map is resetting or rotating which happens when the map resets. The map resets when you start a new full cleanup (a cleanup with specifying any zones). If you have updated to the latest version you can try using the xiaomi app to reset/reload the map.

Thanks a lot!

I guess it resets because I have a scheduled full cleanup once a week… Any idea how can I achieve a full cleanup without resetting the map?

I have the latest Xiaomi app but I can’t figure out how to restore the map. Any idea?

To avoid resetting the map try using zones instead. Either by simply drawing one big zone that includes everything or by simbly passing all the zones that you have created for you apartment/house in one function. There are enough examples in here how to do that.

For editing your map: You’ll find the option to edit the map at the bottom left of your current map.

1 Like

I’ll try that, thanks!

Where at the bottom left? I don’t see anything (see screenshot)

This looks different to my version… Wich device and firmware version are you using? You might be able to edit the map in the top right menu (the one with the three dots).

Try this:

vacuum_clean_house:
  alias: Clean House
  sequence:
  - service: xiaomi_miio.vacuum_clean_zone
    data_template:
      entity_id: vacuum.roborock
      repeats: 1
      zone: 
      - [[25480,17400,29530,22250],[14300,17900,25800,25950]] 
1 Like

Same behaviour… But I solved with a script now just clean a zone , then a delay , then next zone :wink:

1 Like

It’s Android, Xiaomi home app version 5.6.46
I’ve looked everywhere after clicking in the top right corner but without success

I’ve collected the coordinates from Floevac, how do I map the X and Y coordinates from the map? Any suggestions?

  1. select the zone
  2. press and hold the “cleaning” button
  3. the coordinates will be copied