Roborock integration clean several specific rooms

I find the roborock integration lacking compared what you can do with the hacky way of integrating it through HACS.
You can get camera there and if you spend the time to figure out the room ids you can so much more.

First of all - thanks @Lash-L for this custom integration and congrats for getting it into HA core!

I have this working as a HACS custom integration and wanted to switch over to the core integration. I just wanted to ask if there is a good way to do this? I am thinking to remove the custom integration and then add a new core integration and configuring from scratch. Thoughts?

My integration I can select any number of rooms and say clean.

3 Likes

@Lash-L Thanks for the step by step explanation.

I am stuck at step 1. I have enabled the debug logging. But where to find the log?

Settings, systems, logs

hey wguma,

The codes can be found in this way:

Go to Developer Tools > STATES > in the Entity field search for: camera.roborock
Scroll down until you reach the option: room_numbers:
it should be something like this:

room_numbers: 
'16': null
'17': null
'18': null
'19': null
'20': null
'21': null
'22': null
'23': null
'25': null
'26': null
'27': null
'28': null
'29': null

Now you can send the robot to clean using the numbers above and find the rooms that correspond to the numbers. How?

Go to Develop Tools >SERVICES > choose UI mode >
in Service, start typing your robot’s name: Roborock: Vacuum clean segment
Target, choose your device: Roborock S8 Pro Ultra
Segment: enter the any room number and find where the robot goes
and for last, don’t forget to CALL SERVICE! :wink:

If you choose to do the above via yaml mode, replace the below with your enteties name:

service: roborock.vacuum_clean_segment
data:
segments: 16
target:
entity_id: vacuum.roborock_s8_pro_ultra

UI or YAML mode, they both should work.

After that is up to you to maybe create scripts and later use them to on Automations (so, you don’t need to type it everytime.

7 Likes

I guess that wont work for me as i have an S6 and doesn’t have a camera. But a map.

I have sensor.roborock_s6_current_clean_area and shows a number

This must not be using the core integration? I also have the s8 and do not see “Roborock: Vacuum clean segment”

@morreale & @wgumaa
I presume you both have HACS installed.
So, on HACS search and install this:

Lovelace Vacuum Map card

Once you have it installed go to any of your Dashboard and add a New Card.
Search for Custom: Vacuum Map Card
github reference: GitHub - PiotrMachowski/lovelace-xiaomi-vacuum-map-card: This card provides a user-friendly way to fully control map-based vacuums in Home Assistant. Supported brands include Xiaomi (Roborock/Viomi/Dreame/Roidmi/Valetudo/Valetudo RE), Neato, Wyze, Roomba, Ecovacs (and probably more).

On the field “Vaccum entity” add your roborock ententy name (like per picture)

Now click on “SHOW CODE EDITOR”
You should see the default config, like this:

Go back by clicking on “SHOW VISUAL EDITOR”

now click on “GENERATE ROOMS CONFIG”

once again click on Show Code Editor and you should see something like this:
Where ID 16 is a room and you just need to send your roboot there to find where it is
You can also edit it where it says “text: Room 16” and change to the room’s name.

For last, don’t forget to SAVE :wink:

I hope it helps.

4 Likes

Have that open ready to install. I was hoping you would verify. Thanks for the reply!

Cool beans!!! I see the room numbers!

Ok remind me now if i want to send it to a specific room what would the code look like?

hey @wgumaa,

You can use the previous instructions and you should be able to send the vaccum to where you want.

Or - You can:

Click on the button: Zone cleanup (as per picture)
image

Then select: Rooms

Now you can see all rooms’ name on top.
Let’s pick “Room 29” or “Room 26” as example and change their name

Go back to to Edit mode in the Vacuum Map Card
Click on the "SHOW CODE EDITOR’
Find your “Room number” - in this example I’m choosing “Room 29” - and name it as you wish.
Example:
From Room 29:


To new name: Livingroom

Once again, don’t forget to SAVE your changes.

As result, now you can tell which room number is related to their location:
image

I hope it helps.

Cheers :wink:

4 Likes

I’ve created a video with detailed instruction on how to get the Roborock Integration working. How to pick through the diagnostic information to find the room ID’s and how to create a room cleaning automation using Home Assistant as a button on the dashboard.

4 Likes

Hi
I have a Roborock S7 with map car wich is ok in HA (with MIIO integration and not roborock)
My problem is the button GENERATE ROOM CONFIG is grey and I can’t extract room.
Is there a solution ?

Thanks for this video - made it a little clearer than the documentation. Was able to run an automation that cleaned a specific room which is great!
Your implementation is via an automation, I’m wrote a single script to pass through a room ID as an input parameter so I can simply re-use the script and call it with an input parameter via the automation.
This only works for 1 room ID though:

alias: Robot vacuum room clean
sequence:
  - service: vacuum.send_command
    data:
      command: app_segment_clean
      params:
        - segments:
            - "{{ room_id }}"
    target:
      entity_id: vacuum.roborock_s7_maxv
mode: single
icon: mdi:robot-vacuum

call via:

service: script.robot_vacuum_room_clean
data:
  room_id: 16

Would be great to be able to call multiple rooms but I’m a HA novice and not great with the languages used in HA as of yet.

you just add the additional segments like this…

service: roborock.vacuum_clean_segment
data:
  segments:
    - 17
    - 20
    - 19
target:
  entity_id: vacuum.robo

I have a script and automations so that:

when house is empty (last person leaves), the automation is triggered and it:

  1. checks where the robot is docked (as I have a dock on each floor of the house)
  2. loads the correct map for the floor
  3. runs the correct vacuum cleaning program for the floor
  4. sets a switch to say floor_1 cleaned today (so it can only run once a day)

Happy to share if interested.

Yeah I can see how you add multiple segments to the code if you’re hardcoding the numbers. But in my implementation I have 1 script that I call from an automation passing through the id.

I guess if I removed the “-” from the script then I can pass through the IDs like you’ve written. Might give it a go.

I see. Sorry I didn’t spot that you are trying to pass the room number into the script.

1 Like

Valetudo uses a clever script for such cases, that you could adopt. :slight_smile:

  • Setup a few input_booleans with the rooms.
    input_boolean.vacuum_hallway:
      room_id: "18"
    input_boolean.vacuum_livingroom:
      room_id: "16"
    input_boolean.vacuum_bedroom:
      room_id: "20"
    input_boolean.vacuum_kitchen:
      room_id: "17"
    input_boolean.vacuum_study:
      room_id: "19"
    
  • Setup a group with these.
    vacuum_rooms:
     name: Vacuum Rooms
     entities:
       - input_boolean.vacuum_bedroom
       - input_boolean.vacuum_hallway
       - input_boolean.vacuum_kitchen
       - input_boolean.vacuum_livingroom
       - input_boolean.vacuum_study
    
  • Use a script to check the group
    script:
      vacuum_clean_segments:
        alias: vacuum_clean_segments
        sequence:
          - service: mqtt.publish
            data:
              topic: valetudo/xxx
              payload_template: >
                {% set segments = expand("group.vacuum_rooms") | selectattr("state","eq","on") | map(attribute="attributes.vacuum_room_id") | list | to_json %}
                {% set iterations = states('input_number.vacuum_segment_iterations') | int %}
                {"segment_ids": {{ segments }}, "iterations": {{ iterations }}, "customOrder": true }
          - delay: '00:00:02'
          - service: homeassistant.turn_off
            entity_id: group.vacuum_rooms
        mode: single
    

The last one is my config which uses MQTT, but for you to get an idea on how to “expand” the group entries, it should work. :slight_smile:

The original is here on the Valetudo page:

2 Likes