Roborock S5 Zoned Cleanup for Valetudo 2021.06

The previously used vacuum.send_command has been retired as of Valetudo v2021.04 and zoned cleanup must be performed via mqtt.publish now.

This post was written for the Roborock S5 line of robovacs.

Valetudo configuration

Requires MQTT to be configured correctly in the first place with Valetudo and discovery enabled in Home Assistant. You can verify this using MQTT explorer.

Ensure that the segments are named by clicking on the triangle in "Zones -> Edit Segments" and then clicking the cursor icon to rename a segment.

Full documentation can be found on the Valetudo site at https://valetudo.cloud/pages/integrations/home-assistant-integration.html.

Calling segment cleanup from Home Assistant

A single segment can be called like this:

service: mqtt.publish
data:
    topic: valetudo/robovacDown/MapSegmentationCapability/clean/set
    payload: '20'

Multiple segment cleaning requires a JSON array to be passed like this:

service: mqtt.publish
data:
  topic: valetudo/robovacDown/MapSegmentationCapability/clean/set
  payload: '["17", "20"]'

Segment IDs can be obtained from the MQTT topic valetudo/robot/MapData/segments and should look like this:

{
  "16": "DownFrontDining",
  "17": "DownFrontOffice",
  "18": "DownRearHallway",
  "19": "DownKitchen",
  "20": "DownFrontHall",
  "21": "DownLounge",
  "22": "DownLoungeHall"
}