Howto: Xiaomi vacuum zoned cleaning

Untill the map saving feature is available for multiple floors…

I have actually managed to get my xiaomi to work through ifttt (and even in swedish). First of all get your webhooks and and ifttt settings and api correct.

An automation that looks like this:

- alias: Ta emot information från IFTTT
  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 }}'

scripts that look like this:

dammsug_sovrummet:
  alias: "Sovrummet"
  sequence:
    - service: vacuum.send_command
      data:
        entity_id: vacuum.xiaomi_vacuum_cleaner
        command: app_zoned_clean
        params: [[22462,22067,25862,25067,1]]

And a json script in ifttt that looks like this:

{ "action": "call_service", "service": "script.turn_on", "entity_id": "script.dammsug_sovrummet" }

works like a charm.

Thats interresting. So you are not using an api_password (the old way) in the webhook URL but the link youget from hassio when activiating ifttt in integrations(the new way)? This:

I think I managed to answer my question. Use sbobergjes code in the automation file. You do not need the autmation: in that file. Then make a script. To make it work youll need to:

In webhook URL you shall have the string you get from when activation ifttt under integration in hassio. BUT in the config file you need to put this:

ifttt:
  key: YOUR_API_KEY

YOUR_API_KEY is soemthing else. And its a key you get from the webhook from the ifttt homepage.

this:

" key is your API key which can be obtained by viewing the Settings of the Webhooks applet. It’s the last part of the URL (e.g., IFTTT Maker Webhooks) you will find under My Applets > Webhooks > Settings ." Follow the link. Or go my applets->services->webhook->settings

Now the “new way” works so I dont have to use the old way. Thanks mate!

This is my Node RED code.
The delay time depends on your system . I mean there is a lead time between the real time action and the apperance of this action in the system. For example if the vacuum state changes to idle then this state changes in 10-12 seconds later in my system.
It would be more elegant solution the continuous multiple zone cleaning but unfortunately I can’t find any solution for it so far.

[{"id":"78e9d3a9.0ae53c","type":"server-state-changed","z":"726e5921.d034a8","name":"start","server":"820ae6a6.7f40a8","entityidfilter":"input_boolean.zone_cleaning","entityidfiltertype":"substring","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"x":70,"y":240,"wires":[["357dc6d4.090b6a"]]},{"id":"357dc6d4.090b6a","type":"switch","z":"726e5921.d034a8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":230,"y":240,"wires":[["ebe7074c.fa82d8","abaa0754.e498c8","84ec31fe.1f509","74f63762.fb48a8","6129fa6f.15add4","f2f6b719.dd3e68","5f304930.015008"]]},{"id":"ebe7074c.fa82d8","type":"api-current-state","z":"726e5921.d034a8","name":"living room on?","server":"820ae6a6.7f40a8","outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"entity_id":"input_boolean.living_room_cleaning","state_type":"str","override_payload":true,"override_data":true,"x":560,"y":60,"wires":[["e4ef4475.06e5e8"],[]]},{"id":"e4ef4475.06e5e8","type":"api-call-service","z":"726e5921.d034a8","name":"living room cleaning","server":"820ae6a6.7f40a8","service_domain":"vacuum","service":"send_command","data":"{\"entity_id\":\"vacuum.xiaomi_vacuum_cleaner\",\"command\":\"app_zoned_clean\",\"params\":[[21575,24539,26125,29889,1],[25331,24711,28131,28561,1],[20190,23707,26040,24707,1]]}","render_data":true,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":780,"y":60,"wires":[[]]},{"id":"9e091322.64a63","type":"api-call-service","z":"726e5921.d034a8","name":"bedroom off","server":"820ae6a6.7f40a8","service_domain":"input_boolean","service":"turn_off","data":"{\"entity_id\":\"input_boolean.bedroom_cleaning\"}","render_data":false,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":790,"y":500,"wires":[[]]},{"id":"9feb35ca.7ad458","type":"api-call-service","z":"726e5921.d034a8","name":"bedroom cleaning","server":"820ae6a6.7f40a8","service_domain":"vacuum","service":"send_command","data":"{\"entity_id\":\"vacuum.xiaomi_vacuum_cleaner\",\"command\":\"app_zoned_clean\",\"params\":[[18720,19114,21770,23514,1]]}","render_data":false,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":770,"y":120,"wires":[["566f36a2.63abb8"]]},{"id":"abaa0754.e498c8","type":"api-current-state","z":"726e5921.d034a8","name":"bedroom on?","server":"820ae6a6.7f40a8","outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"entity_id":"input_boolean.bedroom_cleaning","state_type":"str","override_payload":true,"override_data":true,"x":550,"y":120,"wires":[["9feb35ca.7ad458"],[]]},{"id":"c4e673e1.89d07","type":"trigger-state","z":"726e5921.d034a8","name":"paused?","server":"820ae6a6.7f40a8","entityid":"vacuum.xiaomi_vacuum_cleaner","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"id":"pq55xe30min","targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"paused"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":80,"y":120,"wires":[["97097ff0.f3702"],[]]},{"id":"97097ff0.f3702","type":"change","z":"726e5921.d034a8","name":"send on","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":240,"y":120,"wires":[["357dc6d4.090b6a"]]},{"id":"ec589d7f.8318d","type":"api-call-service","z":"726e5921.d034a8","name":"girls room cleaning","server":"820ae6a6.7f40a8","service_domain":"vacuum","service":"send_command","data":"{\"entity_id\":\"vacuum.xiaomi_vacuum_cleaner\",\"command\":\"app_zoned_clean\",\"params\":[[25014,19161,28214,23761,1]]}","render_data":false,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":770,"y":180,"wires":[["566f36a2.63abb8"]]},{"id":"96668fda.d83af","type":"api-call-service","z":"726e5921.d034a8","name":"girls room off","server":"820ae6a6.7f40a8","service_domain":"input_boolean","service":"turn_off","data":"{\"entity_id\":\"input_boolean.girls_room_cleaning\"}","render_data":false,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":790,"y":560,"wires":[[]]},{"id":"84ec31fe.1f509","type":"api-current-state","z":"726e5921.d034a8","name":"girls room on?","server":"820ae6a6.7f40a8","outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"entity_id":"input_boolean.girls_room_cleaning","state_type":"str","override_payload":true,"override_data":true,"x":560,"y":180,"wires":[["ec589d7f.8318d"],[]]},{"id":"8bef2f33.3f41b","type":"api-current-state","z":"726e5921.d034a8","name":"living room off?","server":"820ae6a6.7f40a8","outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"entity_id":"input_boolean.living_room_cleaning","state_type":"str","override_payload":true,"override_data":true,"x":560,"y":500,"wires":[["9e091322.64a63","c088e19f.5769"],[]]},{"id":"c088e19f.5769","type":"api-current-state","z":"726e5921.d034a8","name":"bedroom off?","server":"820ae6a6.7f40a8","outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"entity_id":"input_boolean.bedroom_cleaning","state_type":"str","override_payload":true,"override_data":true,"x":550,"y":560,"wires":[["96668fda.d83af","45c99c1e.1724c4"],[]]},{"id":"45c99c1e.1724c4","type":"api-current-state","z":"726e5921.d034a8","name":"girls room off?","server":"820ae6a6.7f40a8","outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"entity_id":"input_boolean.girls_room_cleaning","state_type":"str","override_payload":true,"override_data":true,"x":560,"y":620,"wires":[["5b98fa32.f77764","6257ae9b.10912"],[]]},{"id":"49b78f9a.a3a9c","type":"api-call-service","z":"726e5921.d034a8","name":"zone off","server":"820ae6a6.7f40a8","service_domain":"input_boolean","service":"turn_off","data":"{\"entity_id\":\"input_boolean.zone_cleaning\"}","render_data":false,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":780,"y":800,"wires":[[]]},{"id":"36476426.035acc","type":"api-call-service","z":"726e5921.d034a8","name":"middle room cleaning","server":"820ae6a6.7f40a8","service_domain":"vacuum","service":"send_command","data":"{\"entity_id\":\"vacuum.xiaomi_vacuum_cleaner\",\"command\":\"app_zoned_clean\",\"params\":[[21848,19087,24798,23587,1]]}","render_data":false,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":780,"y":240,"wires":[["566f36a2.63abb8"]]},{"id":"74f63762.fb48a8","type":"api-current-state","z":"726e5921.d034a8","name":"middle room on?","server":"820ae6a6.7f40a8","outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"entity_id":"input_boolean.middle_room_cleaning","state_type":"str","override_payload":true,"override_data":true,"x":570,"y":240,"wires":[["36476426.035acc"],[]]},{"id":"5b98fa32.f77764","type":"api-call-service","z":"726e5921.d034a8","name":"middle room off","server":"820ae6a6.7f40a8","service_domain":"input_boolean","service":"turn_off","data":"{\"entity_id\":\"input_boolean.middle_room_cleaning\"}","render_data":false,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":800,"y":620,"wires":[[]]},{"id":"6257ae9b.10912","type":"api-current-state","z":"726e5921.d034a8","name":"middle room on?","server":"820ae6a6.7f40a8","outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"entity_id":"input_boolean.middle_room_cleaning","state_type":"str","override_payload":true,"override_data":true,"x":570,"y":680,"wires":[["24c7fae4.31b476","5bfc543c.c8f03c"],[]]},{"id":"3445141b.e0737c","type":"api-call-service","z":"726e5921.d034a8","name":"bathroom cleaning","server":"820ae6a6.7f40a8","service_domain":"vacuum","service":"send_command","data":"{\"entity_id\":\"vacuum.xiaomi_vacuum_cleaner\",\"command\":\"app_zoned_clean\",\"params\":[[18784,24774,21534,28074,1]]}","render_data":false,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":770,"y":300,"wires":[["566f36a2.63abb8"]]},{"id":"6129fa6f.15add4","type":"api-current-state","z":"726e5921.d034a8","name":"bathroom on?","server":"820ae6a6.7f40a8","outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"entity_id":"input_boolean.bathroom_cleaning","state_type":"str","override_payload":true,"override_data":true,"x":560,"y":300,"wires":[["3445141b.e0737c"],[]]},{"id":"24c7fae4.31b476","type":"api-call-service","z":"726e5921.d034a8","name":"bathroom off","server":"820ae6a6.7f40a8","service_domain":"input_boolean","service":"turn_off","data":"{\"entity_id\":\"input_boolean.bathroom_cleaning\"}","render_data":false,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":790,"y":680,"wires":[[]]},{"id":"5bfc543c.c8f03c","type":"api-current-state","z":"726e5921.d034a8","name":"bathroom off?","server":"820ae6a6.7f40a8","outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"entity_id":"input_boolean.bathroom_cleaning","state_type":"str","override_payload":true,"override_data":true,"x":560,"y":740,"wires":[["fff0e48e.dd20f8","4a68873b.aed1b8"],[]]},{"id":"25e2c6b6.8cccfa","type":"api-call-service","z":"726e5921.d034a8","name":"entrance cleaning","server":"820ae6a6.7f40a8","service_domain":"vacuum","service":"send_command","data":"{\"entity_id\":\"vacuum.xiaomi_vacuum_cleaner\",\"command\":\"app_zoned_clean\",\"params\":[[26041,23630,28341,24880,1]]}","render_data":false,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":770,"y":360,"wires":[["566f36a2.63abb8"]]},{"id":"f2f6b719.dd3e68","type":"api-current-state","z":"726e5921.d034a8","name":"entrance on?","server":"820ae6a6.7f40a8","outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"entity_id":"input_boolean.entrance_cleaning","state_type":"str","override_payload":true,"override_data":true,"x":550,"y":360,"wires":[["25e2c6b6.8cccfa"],[]]},{"id":"4a68873b.aed1b8","type":"api-current-state","z":"726e5921.d034a8","name":"entrance off?","server":"820ae6a6.7f40a8","outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"entity_id":"input_boolean.entrance_cleaning","state_type":"str","override_payload":true,"override_data":true,"x":550,"y":800,"wires":[["49b78f9a.a3a9c","57736bfd.7e30e4"],[]]},{"id":"fff0e48e.dd20f8","type":"api-call-service","z":"726e5921.d034a8","name":"entrance off off","server":"820ae6a6.7f40a8","service_domain":"input_boolean","service":"turn_off","data":"{\"entity_id\":\"input_boolean.entrance_cleaning\"}","render_data":false,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":800,"y":740,"wires":[[]]},{"id":"566f36a2.63abb8","type":"trigger-state","z":"726e5921.d034a8","name":"cleaning?","server":"820ae6a6.7f40a8","entityid":"vacuum.xiaomi_vacuum_cleaner","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"id":"3p107e8yejh","targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"returning"},{"id":"vk9pzh79rgp","targetType":"entity_id","targetValue":"input_boolean.zone_cleaning","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":true,"state_type":"str","x":1050,"y":236.66665649414062,"wires":[["6ff84c1b.f574b4"],[]]},{"id":"6ff84c1b.f574b4","type":"api-call-service","z":"726e5921.d034a8","name":"roberta stop","server":"820ae6a6.7f40a8","service_domain":"vacuum","service":"send_command","data":"{\"entity_id\":\"vacuum.xiaomi_vacuum_cleaner\",\"command\":\"app_pause\"}","render_data":true,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":1250,"y":240,"wires":[[]]},{"id":"3741d9ef.2e5426","type":"api-call-service","z":"726e5921.d034a8","name":"Return to base","server":"820ae6a6.7f40a8","service_domain":"vacuum","service":"return_to_base","data":"{\"entity_id\":\"vacuum.xiaomi_vacuum_cleaner\"}","render_data":false,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":800,"y":860,"wires":[[]]},{"id":"57736bfd.7e30e4","type":"api-current-state","z":"726e5921.d034a8","name":"zone off?","server":"820ae6a6.7f40a8","outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"entity_id":"input_boolean.entrance_cleaning","state_type":"str","override_payload":true,"override_data":true,"x":540,"y":860,"wires":[["3741d9ef.2e5426"],[]]},{"id":"5f304930.015008","type":"stoptimer","z":"726e5921.d034a8","duration":"15","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":350,"y":440,"wires":[["299051d4.c4b58e"],[]]},{"id":"6f72eea4.dc4cb","type":"api-call-service","z":"726e5921.d034a8","name":"living room off","server":"820ae6a6.7f40a8","service_domain":"input_boolean","service":"turn_off","data":"{\"entity_id\":\"input_boolean.living_room_cleaning\"}","render_data":false,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":800,"y":440,"wires":[[]]},{"id":"299051d4.c4b58e","type":"api-current-state","z":"726e5921.d034a8","name":"living room off?","server":"820ae6a6.7f40a8","outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"entity_id":"input_boolean.living_room_cleaning","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":560,"y":440,"wires":[["8bef2f33.3f41b","6f72eea4.dc4cb"]]},{"id":"820ae6a6.7f40a8","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open"}]

And the appearance on Hadashboard:

Thanks for the integration of mop function to tjntomas

2 Likes

I’ve accomplished continuous zone cleaning in my node-red automation using the simple-message-queue node. Also, you can reduce the scan interval in your config.yaml for the vacuum component in order to get it closer to real-time updates in HA.

When I get a chance I’ll send what my automation looks like.

1 Like

Thank you for the idea. I’m a begginner at NodeRED, this is my 2nd flow that was written so I don’t know all possibilities yet. I’m waiting for your solution. :slight_smile:
The scan interval is globalyl changed or only at vacuum? What is the optimal scan interval?

You set it just for the vacuum under the xiaomi_miio section of the config.yaml. See here for more info: https://www.home-assistant.io/docs/configuration/platform_options/

I think the default is 20 sec for this component. I believe I changed mine to 10.

Just for quick question for those using it on multiple floors: Is it possible to use it on another floor without moving the base station? How does it know where to go when the cleaning on that other floor is finished? Of course, afterwards I have to put it on the base station myself.

And the map is definitely lost, when doing a full clean on another floor, right?

I just place it upstairs and starts creating a map, it goes back to the place it started from. Then I lift it back down onto the dock… then the map appears again for downstairs.

Should not be possible with , the new saved map feature is only able to save 1 map only…
So this needs to be turned off if you move your roborock without the base

It works perfectly for me… It just desn’t remember the 2nd map once back on the Dock. If you turn off the maps then they are wiped

hmm, gonna try it again

so you have the map feature turned on? ok … so you move it up stairs with the saved map from downstairs
so how do you do then a clean? a clean map wipes, and a zone map is not working since its another floor ?

confused here

press the clean button on the vacuum, once moved upstairs, let it finish… place on dock

weird, normally a clean should create a new map?, or maybe it doesnt once a map is always created?

it does but once in the dock the other map is loaded… just don’t open the app until it is back in the dock :smiley:

ah, thats maybe the trick, dont use the APP when vacuum upstairs :slight_smile:

let me know how you get on!

Will do , when I setup the cleaner in the weekend upstairs :wink:

Ok. I tried it myself. Moved the Roborock upstairs and started a full clean via the button on the vacuum. Without opening the app! After it finished cleaning upstairs, I put it back downstairs on the docking station and started a zone cleaning right in front of the base station through the HA interface (so again without opening the app). Then I opened the Mi home app to see what happened to the map. And voilá. The downstairs map incl. the no-go areas is still there!

1 Like