Some notes before we start:
- This is not exactly a blueprint, but I still like to share it anyway with you.
- It is made for my Roborock S6 MaxV, but it should work with other Xiaomi/Roborock models as well.
- This how-to has been created with the Xiaomi Mii integration in mind.
- If you use a different integration, you most certainly need to do modifications. Feel free to create forks and let me know, so I can link them.
- License of source code: AGPL 3.0
Goal
Create buttons that start cleaning each room. When the cleaning is still in progress, wait for completion before sending the robot to the next room.
Main Script
mode: queued
alias: Roborock Room Cleaning
max: 30
fields:
room:
name: Room
required: true
example: living_room
selector:
select:
options:
- bathroom
- bedroom
- hallway
- kitchen
- living_room
- stairway_landing
sequence:
- choose:
- conditions:
- condition: or
conditions:
- condition: state
entity_id: vacuum.roborock_vacuum_a10
state: cleaning
- condition: state
entity_id: vacuum.roborock_vacuum_a10
state: error
sequence:
- wait_for_trigger:
- platform: state
entity_id: vacuum.roborock_vacuum_a10
to: returning
- platform: state
entity_id: vacuum.roborock_vacuum_a10
to: docked
continue_on_timeout: false
timeout: '01:30:00'
- service: vacuum.send_command
target:
device_id: 1234567
data_template:
command: app_segment_clean
params: >
{% set room_id = states("input_number.roborock_room_enum_" + room)
| int %} {{ room_id }}
- wait_for_trigger:
- platform: state
entity_id: vacuum.roborock_vacuum_a10
to: returning
- platform: state
entity_id: vacuum.roborock_vacuum_a10
to: docked
continue_on_timeout: false
timeout: '01:30:00'
- conditions:
- condition: or
conditions:
- condition: state
entity_id: vacuum.roborock_vacuum_a10
state: returning
- condition: state
entity_id: vacuum.roborock_vacuum_a10
state: docked
- condition: state
entity_id: vacuum.roborock_vacuum_a10
state: idle
sequence:
- service: vacuum.send_command
target:
device_id: 1234567
data_template:
command: app_segment_clean
params: >
{% set room_id = states("input_number.roborock_room_enum_" + room)
| int %} {{ room_id }}
- wait_for_trigger:
- platform: state
entity_id: vacuum.roborock_vacuum_a10
to: returning
- platform: state
entity_id: vacuum.roborock_vacuum_a10
to: docked
continue_on_timeout: false
timeout: '01:30:00'
default: []
Extend or change the room fieldās selector.select.options
as necessary. All valid room ids need to be listed here. Make sure to replace the device_id
and entity_id
with the ids of your vacuum.
Return to Dock Automation
alias: 'Vacuum: Paused for 5 minutes -> cancel cleaning and return to dock'
description: ''
trigger:
- platform: state
entity_id: vacuum.roborock_vacuum_a10
to: paused
for: '00:05:00'
- platform: state
entity_id: vacuum.roborock_vacuum_a10
for: '00:05:00'
to: idle
condition: []
action:
- service: script.turn_off
target:
entity_id: script.roborock_room_cleaning
- device_id: 1234567
domain: vacuum
entity_id: vacuum.roborock_vacuum_a10
type: dock
- service: script.turn_on
target:
entity_id: script.roborock_room_cleaning
mode: queued
max: 10
This automation will return the vacuum after 5 minutes when it is stopped with a button press, the app, etc. or if thereās a rare case of non-successful docking. Make sure to replace the device_id
and entity_id
with the ids of your vacuum.
Error Notification Automation
alias: 'Vacuum: Notify on Error'
description: ''
trigger:
- platform: state
entity_id: vacuum.roborock_vacuum_a10
to: error
condition: []
action:
- device_id: 7654321a
domain: mobile_app
type: notify
title: 'Vacuum: Error'
message: Vacuum encountered an error.
mode: queued
max: 10
If the robot encounters an error youāll get a notification. Just enter the device ID of the mobile app you like to have notified. Make sure to replace the entity_id
with the id of your vacuum.
Room number definition
Create an input_number
per room to act as enum, example for bathroom
:
input_number.roborock_room_enum_bathroom
The ids are usually 15 and above - if you made any manual changes to the map. Just try the ids to identify the rooms.
Buttons
type: entity-button
tap_action:
action: call-service
service: script.roborock_room_cleaning
service_data:
room: bathroom
entity: script.roborock_room_cleaning
icon_height: 60px
icon: hass:robot-vacuum
name: Start
This button will call the script for the room bathroom
. The button will light up as soon as you press it and stop being illuminated after the robot has cleaned all rooms in the (script) queue.
By clicking on two buttons youāll send the robot to the first and then the second room. The queuing in the script will take care of this automatically and command the cleaning of the second room as soon as the robot reports back that it returns to the dock.
I recommend turning the volume of the voice output down to the minimum to avoid all the chatter of the robot while cleaning.
Have fun