Make RoboRock Vacuum Clean Specific Room From Picture Entity

Hey all, I wanted to share some work I had done with the RoboRock vacuum to get it to clean specific rooms from a home assistant interface. The roborock app is great, but I wanted to have a centralized area where I could get it to do the deed. My solution isn’t necessarily the most elegant, but I hadn’t found any other topics on this.

For each room I created an input_boolean helper. This allows me to toggle on whether or not I have the room cleaned, and also show whether the room is set to be cleaned in the picture_elements card of the floor layout. This is then passed to the roborock vacuum to tell it to go and clean things up. In order to do this you will want to reference the roborock integration page and use the roborock.get_maps command in developer mode to get the numbers that correspond to your different rooms. In order to have the numbers match up, I recommend you diligently label the rooms in the roborock app first. Once you have the input_booleans created, you can use this script to pass the information to the robovac

alias: Vacuum Clean Rooms
description: ""
triggers:
  - trigger: state
    entity_id:
      - input_button.vacuum_start_cleaning
conditions: []
actions:
  - action: vacuum.send_command
    metadata: {}
    data:
      command: app_segment_clean
      params:
        - segments: |-
            {{ states.input_boolean | selectattr('state', 'eq', 'on') 
               | selectattr('object_id', 'in', [
                 'dining_room_vacuum', 
                 'mudroom_vacuum', 
                 'back_hall_bathroom_vacuum', 
                 'foyer_vacuum', 
                 'family_room_hall_vacuum', 
                 'kitchen_vacuum', 
                 'great_room_vacuum', 
                 'office_vacuum', 
                 'back_hall_vacuum', 
                 'family_room_vacuum', 
                 'great_room_bathroom_vacuum', 
                 'breakfast_nook_vacuum'
               ]) 
               | map(attribute='object_id') 
               | map('replace', 'dining_room_vacuum', 1) 
               | map('replace', 'mudroom_vacuum', 2)
               | map('replace', 'back_hall_bathroom_vacuum', 3)
               | map('replace', 'foyer_vacuum', 4)
               | map('replace', 'family_room_hall_vacuum', 5)
               | map('replace', 'kitchen_vacuum', 6)
               | map('replace', 'great_room_vacuum', 7)
               | map('replace', 'office_vacuum', 8)
               | map('replace', 'back_hall_vacuum', 9)
               | map('replace', 'family_room_vacuum', 10)
               | map('replace', 'great_room_bathroom_vacuum', 11)
               | map('replace', 'breakfast_nook_vacuum', 12)
               | map('int')
               | list }}
        - repeat: 1
    target:
      entity_id: vacuum.roborock_qrevo_curv
mode: single

Just make sure that your input boolean labels and numbers match up with the numbers in the script. You will also need to create an input button in order to execute the script.

I also made a little script to clear all of the vacuumed rooms, and to select all of them as well, which are pasted below.

alias: Clear vacuum rooms
description: ""
triggers:
  - trigger: state
    entity_id:
      - input_button.vacuum_clear_all_rooms
conditions: []
actions:
  - target:
      entity_id:
        - input_boolean.dining_room_vacuum
        - input_boolean.mudroom_vacuum
        - input_boolean.back_hall_bathroom_vacuum
        - input_boolean.foyer_vacuum
        - input_boolean.kitchen_vacuum
        - input_boolean.great_room_vacuum
        - input_boolean.office_vacuum
        - input_boolean.back_hall_vacuum
        - input_boolean.family_room_vacuum
        - input_boolean.great_room_bathroom_vacuum
        - input_boolean.breakfast_nook_vacuum
        - input_boolean.family_room_hall_vacuum
    action: input_boolean.turn_off
    data: {}
mode: single
alias: Select all vacuum rooms
description: ""
triggers:
  - trigger: state
    entity_id:
      - input_button.vacuum_select_all_rooms
conditions: []
actions:
  - target:
      entity_id:
        - input_boolean.dining_room_vacuum
        - input_boolean.mudroom_vacuum
        - input_boolean.back_hall_bathroom_vacuum
        - input_boolean.foyer_vacuum
        - input_boolean.kitchen_vacuum
        - input_boolean.great_room_vacuum
        - input_boolean.office_vacuum
        - input_boolean.back_hall_vacuum
        - input_boolean.family_room_vacuum
        - input_boolean.great_room_bathroom_vacuum
        - input_boolean.breakfast_nook_vacuum
        - input_boolean.family_room_hall_vacuum
    action: input_boolean.turn_on
    data: {}
mode: single

Finally, you can use a picture elements card in order to use a floorplan to select each of the rooms you want to vacuum. I have a wall mounted tablet that is used by everyone, and this works very well for that.

type: picture-elements
elements:
  - type: state-icon
    entity: input_boolean.breakfast_nook_vacuum
    tap_action:
      action: toggle
    state_color: true
    style:
      top: 15%
      left: 50%
      transform: scale(2,2)
      "--paper-item-icon-color": red
    icon: mdi:chandelier
  - type: state-icon
    icon: mdi:chair-rolling
    tap_action:
      action: toggle
    state_color: true
    entity: input_boolean.office_vacuum
    style:
      top: 75%
      left: 78%
      transform: scale(2,2)
      "--paper-item-icon-color": red
  - type: state-icon
    icon: mdi:silverware-variant
    tap_action:
      action: toggle
    state_color: true
    entity: input_boolean.dining_room_vacuum
    style:
      top: 77%
      left: 43%
      transform: scale(2,2)
      "--paper-item-icon-color": red
  - type: state-icon
    icon: mdi:sofa
    tap_action:
      action: toggle
    state_color: true
    style:
      top: 20%
      left: 20%
      transform: scale(2,2)
      "--paper-item-icon-color": red
    entity: input_boolean.family_room_vacuum
  - type: state-icon
    icon: mdi:sofa
    tap_action:
      action: toggle
    state_color: true
    entity: input_boolean.great_room_vacuum
    style:
      top: 35%
      left: 75%
      transform: scale(2,2)
      "--paper-item-icon-color": red
  - type: state-icon
    icon: mdi:chef-hat
    tap_action:
      action: toggle
    state_color: true
    style:
      top: 40%
      left: 38%
      transform: scale(2,2)
      "--paper-item-icon-color": red
    entity: input_boolean.kitchen_vacuum
  - type: state-icon
    icon: mdi:stool
    tap_action:
      action: toggle
    state_color: true
    style:
      top: 30%
      left: 30%
      transform: scale(1.2,1.2)
      "--paper-item-icon-color": red
    entity: input_boolean.family_room_hall_vacuum
  - type: state-icon
    icon: mdi:washing-machine
    tap_action:
      action: toggle
    state_color: false
    style:
      top: 77%
      left: 27%
      transform: scale(2,2)
      "--paper-item-icon-color": red
    entity: input_boolean.mudroom_vacuum
  - type: state-icon
    icon: mdi:toilet
    tap_action:
      action: toggle
    state_color: true
    style:
      top: 52%
      left: 87%
      transform: scale(1.5,1.5)
      "--paper-item-icon-color": red
    entity: input_boolean.great_room_bathroom_vacuum
  - type: state-icon
    icon: mdi:door-open
    tap_action:
      action: toggle
    state_color: true
    entity: input_boolean.back_hall_vacuum
    style:
      top: 57%
      left: 18%
      transform: scale(2,2)
      "--paper-item-icon-color": red
  - type: state-icon
    icon: mdi:toilet
    tap_action:
      action: toggle
    state_color: true
    style:
      top: 50%
      left: 30%
      transform: scale(1.5,1.5)
      "--paper-item-icon-color": red
    entity: input_boolean.back_hall_bathroom_vacuum
  - type: state-icon
    icon: mdi:stairs
    tap_action:
      action: toggle
    state_color: true
    style:
      top: 60%
      left: 60%
      transform: scale(2,2)
      "--paper-item-icon-color": red
    entity: input_boolean.foyer_vacuum
  - type: state-icon
    icon: mdi:washing-machine
    tap_action:
      action: toggle
    state_color: true
    style:
      top: 77%
      left: 27%
      transform: scale(2,2)
      "--paper-item-icon-color": red
    entity: input_boolean.mudroom_vacuum
image: /local/main_level_3d_vacuum.png

Obviously your picture elements card will be different, but I thought I would throw these in for someone to use in the future. I’m sure there is a more elegant way to do this, but making input booleans doesn’t take too much time for the limited number of rooms on a particular floor.

Hope you find this helpful.

1 Like