Hey Google, clean the living room and the kitchen!
Wouldn’t you expect that to work out of the box with your new modern robot vacuum? With my Xiaomi Roborock S6 it didn’t so this is how I ended up getting it working using HA and IFTTT. This should work with any robot vacuum from Xiaomi with support for maps where rooms can be defined.
This is heavily inspired by Howto: Xiaomi vacuum zoned cleaning and if you want help with setting up the integrations the help you seek is likely in that thread.
Integrations required:
Please make sure the above is already set up and working as I won’t go through that here.
How to set up
IFTTT
Trigger: Google Assistant
Say a phrase with a text ingredient
What do you want to say?
Clean the $
Vacuum the $
Send Roborock to the $
What do you want the Assistant to say in response?
Alright! Sending Roborock to $ !
Service: Webhooks
Make a web request
URL
<Your public Home Assistant IFTTT webhook URL>
Method
POST
Content-type
application/json
Body
{ "action": "vacuum", "area": "{{TextField}}" }
Home Assistant
automations.yaml
- id: '123456789'
alias: Clean room
description: Start Roborock room cleaning triggered from Google Assistant (IFTTT)
trigger:
- event_data:
action: vacuum
event_type: ifttt_webhook_received
platform: event
condition: []
action:
- alias: ''
entity_id: vacuum.roborock
data_template:
area: '{{ trigger.event.data.area }}'
service: python_script.vacuum_room
python_scripts/vacuum_room.py
# Vacuum specific room(s), multiple names for a room can be used
roomConfig = {
16: ["kitchen"],
17: ["living room"],
18: ["nursery", "kids room"]
}
entity_id = data.get("entity_id")
area = data.get("area").lower()
roomsToClean = []
for roomNumber, roomNames in roomConfig.items():
for name in roomNames:
if name in area:
roomsToClean.append(int(roomNumber))
continue
if entity_id is not None and len(roomsToClean) > 0:
service_data = {"entity_id": entity_id, "command": "app_segment_clean", "params": roomsToClean}
hass.services.call("vacuum", "send_command", service_data, False)
Questions
How do I know which room number corresponds to which room?
I figured it out by trial-and-error. Start the Mi Home app and open the Roborock map. In Home Assistant, go to Developer Tools > Services and then try:
Service: vacuum.send_command
Entity: vacuum.roborock
Service Data:
entity_id: vacuum.roborock
command: app_segment_clean
params: [16]
Try different numbers for params
and each room should lit up in the app as Roborock begins room cleaning. You might have to wait a little bit before it shows on the map.
Hope this helps anyone and good luck!