Vacuum Interactive Map Card

I have reconfigured a new card without generating a static config.
Still if I issue command to clean a room twice or three time, roborock runs only once.

can you copy a service call and send it here?

Here it is

{
  "domain": "vacuum",
  "service": "send_command",
  "serviceData": {
    "command": "app_segment_clean",
    "params": [
      {
        "segments": [
          16
        ],
        "repeats": 2
      }
    ],
    "entity_id": "vacuum.roborock_q5_pro"
  }
}

It looks consistent with HA docs…

Looks like it, but still doesn’t clean twice. :cry:

it should be repeat not repeats

1 Like

Uhh, thank you @Mar1us!

So the temporary solution would look the following way:

map_modes:
  - template: vacuum_clean_segment
    service_call_schema:
      service: vacuum.send_command
      service_data:
        command: app_segment_clean
        params:
          - segments: "[[selection]]"
            repeat: "[[repeats]]"
        entity_id: "[[entity_id]]"
    predefined_selections:
      ...

Do I just paste it into config of the card?

Yeah, replace the line:

  - template: vacuum_clean_segment

with:

  - template: vacuum_clean_segment
    service_call_schema:
      service: vacuum.send_command
      service_data:
        command: app_segment_clean
        params:
          - segments: "[[selection]]"
            repeat: "[[repeats]]"
        entity_id: "[[entity_id]]"
1 Like

Thanks for the solution!

Hi Piotr and thanks for the amazing card!
I too have now started using this card as Roborock core support came along :slight_smile:
Noticed one issue though: Zone cleaning does not work correctly. With a little debugging, the problem seem to be in app_zoned_clean parameters missing the last parameter - the card seems to send the command like this:


When sending the command (in Devtools) like below, it works correctly

action: vacuum.send_command
data:
  command: app_zoned_clean
  params:
      - - 22164
        - 19517
        - 23339
        - 19860
        - 1
target:
  entity_id: vacuum.xxx

Do you have the latest version of the card? Can you post your config as well?

Hi Piotr, I have v2.3.1. Config below (it is actually a part of stack card, stripped those and all the heavy card-modding parts)

type: custom:xiaomi-vacuum-map-card
visibility:
  - condition: state
    entity: input_boolean.ui_expand_vacmap
    state: "on"
preset_name: Downstairs
two_finger_pan: true
map_locked: true
map_source:
  camera: image.xxx_downstairs_custom
  crop:
    top: 120
    bottom: 160
    left: 50
    right: 50
calibration_source:
  camera: true
entity: vacuum.xxx
vacuum_platform: Roborock
conditions:
  - entity: select.xxx_valittu_kartta
    value: Downstairs
tiles: []
icons:
  - icon: mdi:home-floor-1
    tooltip: Vaihda kartta
    tap_action:
      action: call-service
      service: select.select_option
      service_data:
        entity_id: select.xxx_valittu_kartta
        option: Upstairs
map_modes:
  - template: vacuum_clean_segment
    repeats_type: NONE
    predefined_selections:
      - id: "16"
        icon:
          name: mdi:stairs-up
          x: 27270
          "y": 25175
        label:
          text: Hallway
          x: 26950
          "y": 25075
          offset_y: 35
        outline:
          - - 25150
            - 23250
          - - 27950
            - 23250
          - - 27950
            - 27700
          - - 25150
            - 27700
      - id: "17"
        icon:
          name: mdi:sofa
          x: 22450
          "y": 27000
        label:
          text: Living room
          x: 22950
          "y": 25975
          offset_y: 35
        outline:
          - - 20800
            - 23450
          - - 25100
            - 23450
          - - 25100
            - 27700
          - - 20800
            - 27700
      - id: "18"
        icon:
          name: mdi:sofa-outline
          x: 21550
          "y": 21175
        label:
          text: TV room
          x: 22950
          "y": 21400
          offset_y: 35
        outline:
          - - 20700
            - 19450
          - - 24400
            - 19450
          - - 24400
            - 23500
          - - 20700
            - 23500
      - id: "19"
        icon:
          name: mdi:desktop-tower-monitor
          x: 27275
          "y": 21325
        label:
          text: T's room
          x: 26175
          "y": 20900
          offset_y: 35
        outline:
          - - 24400
            - 19450
          - - 27550
            - 19450
          - - 27550
            - 23200
          - - 24400
            - 23200
      - id: "20"
        icon:
          name: mdi:door
          x: 29550
          "y": 23900
        label:
          text: Porch
          x: 28750
          "y": 24900
          offset_y: 35
        outline:
          - - 28000
            - 23350
          - - 29500
            - 23350
          - - 29500
            - 25850
          - - 28000
            - 25850
      - id: "21"
        icon:
          name: mdi:pot-steam-outline
          x: 27050
          "y": 29925
        label:
          text: Kitchen
          x: 26050
          "y": 29725
          offset_y: 35
        outline:
          - - 24100
            - 27750
          - - 28000
            - 27750
          - - 28000
            - 32100
          - - 24100
            - 32100
      - id: "22"
        icon:
          name: mdi:washing-machine
          x: 29800
          "y": 27000
        label:
          text: KHH
          x: 28900
          "y": 27400
          offset_y: 35
        outline:
          - - 27950
            - 25900
          - - 30200
            - 25900
          - - 30200
            - 28500
          - - 27950
            - 28500
      - id: "24"
        icon:
          name: mdi:toilet
          x: 25925
          "y": 27025
        label:
          text: WC
          x: 25925
          "y": 27525
          offset_y: 35
        outline:
          - - 25250
            - 26100
          - - 26600
            - 26100
          - - 26600
            - 27550
          - - 25250
            - 27550
  - template: vacuum_clean_zone
    repeats_type: NONE
  - template: vacuum_goto
additional_presets:
  - preset_name: Upstairs
    conditions:
      - entity: select.xxx_valittu_kartta
        value: Upstairs
    two_finger_pan: true
    map_locked: true
    map_source:
      camera: image.xxx_upstairs_custom
      crop:
        top: 300
        bottom: 140
        left: 95
        right: 140
    calibration_source:
      camera: true
    entity: vacuum.xxx
    vacuum_platform: Roborock
    tiles: []
    icons:
      - icon: mdi:home-floor-2
        tooltip: Vaihda kartta
        tap_action:
          action: call-service
          service: select.select_option
          service_data:
            entity_id: select.xxx_valittu_kartta
            option: Downstairs
    map_modes:
      - template: vacuum_clean_segment
        repeats_type: NONE
        predefined_selections:
          - id: "16"
            icon:
              name: mdi:toilet
              x: 23475
              "y": 21275
            label:
              text: WC y
              x: 23475
              "y": 21675
              offset_y: 35
            outline:
              - - 22800
                - 20300
              - - 24150
                - 20300
              - - 24150
                - 22250
              - - 22800
                - 22250
          - id: "17"
            icon:
              name: mdi:laptop
              x: 25750
              "y": 20075
            label:
              text: M's room
              x: 25750
              "y": 20075
              offset_y: 35
            outline:
              - - 24200
                - 18050
              - - 27300
                - 18050
              - - 27300
                - 22100
              - - 24200
                - 22100
          - id: "18"
            icon:
              name: mdi:bed
              x: 25200
              "y": 24075
            label:
              text: Bedroom
              x: 25200
              "y": 24075
              offset_y: 35
            outline:
              - - 23050
                - 22150
              - - 27350
                - 22150
              - - 27350
                - 26000
              - - 23050
                - 26000
          - id: "19"
            icon:
              name: mdi:stairs-down
              x: 22225
              "y": 18350
            label:
              text: Stairs
              x: 22225
              "y": 18650
              offset_y: 35
            outline:
              - - 21750
                - 18000
              - - 22700
                - 18000
              - - 22700
                - 19300
              - - 21750
                - 19300
          - id: "20"
            icon:
              name: mdi:broom
              x: 23475
              "y": 19100
            label:
              text: Hallway
              x: 23475
              "y": 19100
              offset_y: 35
            outline:
              - - 22750
                - 18000
              - - 24200
                - 18000
              - - 24200
                - 20200
              - - 22750
                - 20200
      - template: vacuum_clean_zone
        repeats_type: NONE
      - template: vacuum_goto

I see that you have added this line:

Room cleaning should work correctly after removing it

Ah ok :slight_smile: I wanted the repeat option away from UI, and saw the instruction to do it like that… So, I guess further card-modding is the way then…
Thanks

Ok, in such case you should use the following config:

    repeats_type: NONE
    service_call_schema:
      service: vacuum.send_command
      service_data:
        command: app_segment_clean
        params:
          - segments: "[[selection]]"
            repeats: 1
        entity_id: "[[entity_id]]"

Ok, how about the zoned clean? It does not seem to work with “repeats” parameter…

It would be much harder to override it for zone cleaning, so I suggest a different approach (it will work for both room and zone cleaning, so you can remove the config from my previous comment).

card_mod:
  style: |
    .map-actions-item:nth-last-child(2) {
      display: none;
    }

Perfect. That does the trick. Thank you!

I just flashed my Roborock S5 with Valetudo and tried to add it to home assistant.
I created 3 segments to seperate different rooms in Valetudo:

I wanted to define a predefined point for the vacuum_goto_predefined but it is not visible.

type: custom:xiaomi-vacuum-map-card
entity: vacuum.valetudo_dobby
map_source:
  camera: camera.dobby_camera
calibration_source:
  camera: true
tiles: []
map_modes:
  - template: vacuum_goto_predefined
    predefined_selection:
      - position: [[2700, 2375]]
        label:
          text: sdfsafsdfsdfafsdfsfsdfsdfsdf
          x: 2700
          "y": 2400
          offset_y: 35
        icon:
          name: mdi:desk
          x: 2600
          "y": 2400
vacuum_platform: Hypfer/Valetudo

I already defined predefined selections and they are shown in the map

type: custom:xiaomi-vacuum-map-card
entity: vacuum.valetudo_dobby
map_source:
  camera: camera.dobby_camera
calibration_source:
  camera: true
tiles: []
map_modes:
  - template: vacuum_clean_segment
    predefined_selections:
      - id: 19
        icon:
          name: mdi:desk
          x: 2635
          "y": 2425
      
      - id: 18
        label: null
        icon:
          name: mdi:toilet
          x: 2340
          "y": 2470
          
        outline:
          - - 2230
            - 2360
          - - 2450
            - 2360
          - - 2450
            - 2580
          - - 2230
            - 2580
vacuum_platform: Hypfer/Valetudo

As the predefined selections are shown i guess the position is correct.

What am I doing wrong?

1 Like