Vacuum Interactive Map Card

You have a really weird config, it seems that you have copied it from several posts for different vacuums.

Which model do you have and which integration do you use to control it?

I have a Roborock S7 and use the Xiaomi Miio integration. Unfortunately, I can’t remember how the configuration came about.

Use following config instead. I also suspect that your room IDs are incorrect (vacuum would finish cleaning right after starting). In this case create a new card and follow these steps. You can replace IDs based on the newly generated card.

type: custom:xiaomi-vacuum-map-card
map_source:
  camera: camera.xiaomi_cloud_map_extractor
calibration_source:
  camera: true
entity: vacuum.alfredo
vacuum_platform: default
map_modes:
  - template: vacuum_clean_segment
    predefined_selections:
      - id: 1
        outline:
          - - 17444
            - 21264
          - - 20016
            - 21264
          - - 20115
            - 20621
          - - 20016
            - 20571
          - - 19917
            - 19631
          - - 19719
            - 18592
          - - 19967
            - 18493
          - - 19967
            - 18345
          - - 19373
            - 18295
          - - 19373
            - 17454
          - - 17542
            - 17405
          - - 17394
            - 21264
        label:
          text: Bad
          x: 18680
          'y': 19483
          offset_y: 25
        icon:
          name: mdi:shower
          x: 18680
          'y': 19483
      - id: 2
        outline:
          - - 20610
            - 20126
          - - 21946
            - 20126
          - - 21995
            - 18493
          - - 22639
            - 18196
          - - 22639
            - 17949
          - - 22342
            - 17999
          - - 22243
            - 17603
          - - 20363
            - 17553
          - - 20363
            - 18493
          - - 20561
            - 18493
          - - 20561
            - 20225
        label:
          text: BĂźro
          x: 21282
          'y': 18917
          offset_y: 25
        icon:
          name: mdi:office-building
          x: 21282
          'y': 18917
      - id: 3
        outline:
          - - 17938
            - 25371
          - - 21303
            - 25321
          - - 21204
            - 21412
          - - 20363
            - 21462
          - - 20214
            - 22006
          - - 17444
            - 22056
          - - 17938
            - 25371
        label:
          text: Schlafzimmer
          x: 20482
          'y': 23615
          offset_y: 25
        icon:
          name: mdi:bed
          x: 20482
          'y': 23615
      - id: 4
        outline:
          - - 22490
            - 25371
          - - 23876
            - 25371
          - - 23876
            - 23342
          - - 24816
            - 23342
          - - 24766
            - 22550
          - - 24271
            - 22550
          - - 24271
            - 21759
          - - 23678
            - 21808
          - - 23678
            - 21412
          - - 22886
            - 21462
          - - 22886
            - 21709
          - - 22540
            - 21808
          - - 22441
            - 25371
        label:
          text: Kinderzimmer
          x: 23258
          'y': 23562
          offset_y: 25
        icon:
          name: mdi:teddy-bear
          x: 23258
          'y': 23562
      - id: 5
        outline:
          - - 27636
            - 19730
          - - 27586
            - 18147
          - - 26894
            - 18048
          - - 26894
            - 17405
          - - 27636
            - 17454
          - - 27685
            - 16861
          - - 30060
            - 16811
          - - 30060
            - 19730
          - - 27586
            - 19780
        label:
          text: KĂźche
          x: 28744
          'y': 18925
          offset_y: 35
        icon:
          name: mdi:pot-steam
          x: 28744
          'y': 18295
      - id: 6
        outline:
          - - 25112
            - 26756
          - - 30406
            - 26855
          - - 30505
            - 20423
          - - 27388
            - 20571
          - - 27586
            - 18741
          - - 25607
            - 18691
          - - 25409
            - 20423
          - - 20165
            - 20373
          - - 20165
            - 21363
          - - 25112
            - 21412
          - - 25063
            - 26805
        label:
          text: Wohnzimmer
          x: 27982
          'y': 23936
          offset_y: 35
        icon:
          name: mdi:sofa
          x: 27982
          'y': 23936
  - template: vacuum_clean_zone
  - template: vacuum_goto

You were right the room ids are wrong. Unfortunately I can’t press the “generate rooms config” button on the newly generated map - it is grayed out.

Have you added rooms to config of Map Extractor and reloaded it?

camera:
  - platform: xiaomi_cloud_map_extractor
    host: !secret xiaomi_vacuum_host
    token: !secret xiaomi_vacuum_token
    username: !secret xiaomi_cloud_username
    password: !secret xiaomi_cloud_password
    draw: ['all']
    attributes:
      - calibration_points
      - rooms

Of course I didn’t. Now I can use the generate rooms config button but unfortunately nothing happens. What do I have to do next now? The rooms are now shown under the attributes

It should add rooms to your config. They will be available in modes menu. Can you show your config of the card? (create one from the scratch and just click “generate rooms config” button

This is what my config looks like

type: custom:xiaomi-vacuum-map-card
map_source:
  camera: camera.xiaomi_cloud_map_extractor
calibration_source:
  camera: true
entity: vacuum.alfredo
vacuum_platform: default

And when I press generate rooms config nothing happens
Can I upload a video here then I could show it?

Does the yaml config stay unchanged after clicking the button? Can you check if there are any errors in browser’s console (you can open it using F12 key)?

Yes after pressing the button it remains unchanged. There are no errors in the console.

Is the map card inside some other card (conditional/grid/…)?

The map was in a grid. It works now. Thank you so much

Next release will fix it (it is already fixed in beta) :slight_smile:

Excellent. Really have to give kudos for the card. Very good work.

1 Like

@3_14
Everything is working as it should now. Can you help me to change the room color? I would like room id17 in red. Can you put that in my code for me?

square: true
columns: 3
type: grid
cards:
  - type: custom:xiaomi-vacuum-map-card
    map_source:
      camera: camera.xiaomi_cloud_map_extractor
    calibration_source:
      camera: true
    entity: vacuum.alfredo
    vacuum_platform: default
    map_modes:
      - name: Zone cleanup
        icon: mdi:select-drag
        run_immediately: false
        coordinates_rounding: true
        selection_type: MANUAL_RECTANGLE
        max_selections: 5
        repeats_type: EXTERNAL
        max_repeats: 3
        service_call_schema:
          service: xiaomi_miio.vacuum_clean_zone
          service_data:
            zone: '[[selection]]'
            repeats: '[[repeats]]'
            entity_id: '[[entity_id]]'
        predefined_selections: []
        variables: {}
      - name: Pin & Go
        icon: mdi:map-marker-plus
        run_immediately: false
        coordinates_rounding: true
        selection_type: MANUAL_POINT
        max_selections: 999
        repeats_type: NONE
        max_repeats: 1
        service_call_schema:
          service: xiaomi_miio.vacuum_goto
          service_data:
            x_coord: '[[point_x]]'
            y_coord: '[[point_y]]'
            entity_id: '[[entity_id]]'
        predefined_selections: []
        variables: {}
      - name: Rooms
        icon: mdi:floor-plan
        run_immediately: false
        coordinates_rounding: true
        selection_type: ROOM
        max_selections: 999
        repeats_type: REPEAT
        max_repeats: 3
        service_call_schema:
          service: xiaomi_miio.vacuum_clean_segment
          service_data:
            segments: '[[selection]]'
            entity_id: '[[entity_id]]'
        predefined_selections:
          - id: '16'
            icon:
              name: mdi:chef-hat
              x: 28815
              'y': 18278
            label:
              text: KĂźche
              x: 28815
              'y': 18278
              offset_y: 35
            outline:
              - - 27626
                - 19688
              - - 30045
                - 19704
              - - 30063
                - 16812
              - - 27626
                - 16841
              - - 27538
                - 17486
              - - 26863
                - 17486
              - - 26892
                - 18015
              - - 27628
                - 18103
              - - 27626
                - 19688
          - id: '17'
            icon:
              name: mdi:sofa
              x: 27626
              'y': 23592
            label:
              text: Wohnzimmer
              x: 27626
              'y': 23592
              offset_y: 35
            outline:
              - - 25073
                - 26791
              - - 30473
                - 26850
              - - 30503
                - 20451
              - - 27421
                - 20569
              - - 27421
                - 18807
              - - 25513
                - 18719
              - - 25454
                - 20334
              - - 20201
                - 20304
              - - 20142
                - 21420
              - - 25161
                - 21390
              - - 25073
                - 26791
          - id: '18'
            icon:
              name: mdi:teddy-bear
              x: 23600
              'y': 23592
            label:
              text: Kinderzimmer
              x: 23600
              'y': 23592
              offset_y: 35
            outline:
              - - 22461
                - 25382
              - - 24721
                - 25382
              - - 24721
                - 21508
              - - 22431
                - 21508
              - - 22461
                - 25382
          - id: '19'
            icon:
              name: mdi:broom
              x: 18700
              'y': 24475
            label:
              text: Room 19
              x: 18700
              'y': 24475
              offset_y: 35
            outline: null
          - id: '20'
            icon:
              name: mdi:broom
              x: 21400
              'y': 18850
            label:
              text: Room 20
              x: 21400
              'y': 18850
              offset_y: 35
            outline: null
          - id: '21'
            icon:
              name: mdi:broom
              x: 18800
              'y': 19600
            label:
              text: Room 21
              x: 18800
              'y': 19600
              offset_y: 35
            outline: null
        variables: {}
    tiles:
      - tile_id: status
        entity: vacuum.alfredo
        label: Status
        attribute: status
        icon: mdi:robot-vacuum
        translations:
          starting: Starting
          charger disconnected: Charger disconnected
          idle: Idle
          remote control active: Remote control active
          cleaning: Cleaning
          returning home: Returning home
          manual mode: Manual mode
          charging: Charging
          charging problem: Charging problem
          paused: Paused
          spot cleaning: Spot cleaning
          error: Error
          shutting down: Shutting down
          updating: Updating
          docking: Docking
          going to target: Going to target
          zoned cleaning: Zoned cleaning
          segment cleaning: Segment cleaning
          emptying the bin: Emptying the bin
          charging complete: Charging complete
          device offline: Device offline
      - tile_id: battery_level
        entity: vacuum.alfredo
        label: Battery
        attribute: battery_level
        icon: mdi:battery-charging-100
        unit: '%'
      - tile_id: fan_speed
        entity: vacuum.alfredo
        label: Fan speed
        attribute: fan_speed
        icon: mdi:fan
        translations:
          silent: Silent
          standard: Standard
          medium: Medium
          turbo: Turbo
          auto: Auto
          gentle: Gentle
    icons:
      - icon: mdi:play
        conditions:
          - entity: vacuum.alfredo
            value_not: cleaning
          - entity: vacuum.alfredo
            value_not: error
          - entity: vacuum.alfredo
            value_not: returning
        tooltip: Start
        tap_action:
          action: call-service
          service: vacuum.start
          service_data:
            entity_id: vacuum.alfredo
      - icon: mdi:pause
        conditions:
          - entity: vacuum.alfredo
            value_not: docked
          - entity: vacuum.alfredo
            value_not: idle
          - entity: vacuum.alfredo
            value_not: error
          - entity: vacuum.alfredo
            value_not: paused
        tooltip: Pause
        tap_action:
          action: call-service
          service: vacuum.pause
          service_data:
            entity_id: vacuum.alfredo
      - icon: mdi:stop
        conditions:
          - entity: vacuum.alfredo
            value_not: docked
          - entity: vacuum.alfredo
            value_not: idle
          - entity: vacuum.alfredo
            value_not: error
          - entity: vacuum.alfredo
            value_not: paused
        tooltip: Stop
        tap_action:
          action: call-service
          service: vacuum.stop
          service_data:
            entity_id: vacuum.alfredo
      - icon: mdi:home-map-marker
        conditions:
          - entity: vacuum.alfredo
            value_not: docked
          - entity: vacuum.alfredo
            value_not: returning
        tooltip: Return to base
        tap_action:
          action: call-service
          service: vacuum.return_to_base
          service_data:
            entity_id: vacuum.alfredo
      - icon: mdi:target-variant
        conditions:
          - entity: vacuum.alfredo
            value_not: docked
          - entity: vacuum.alfredo
            value_not: error
          - entity: vacuum.alfredo
            value_not: cleaning
          - entity: vacuum.alfredo
            value_not: returning
        tooltip: Clean spot
        tap_action:
          action: call-service
          service: vacuum.clean_spot
          service_data:
            entity_id: vacuum.alfredo
      - icon: mdi:map-marker
        tooltip: Locate
        tap_action:
          action: call-service
          service: vacuum.locate
          service_data:
            entity_id: vacuum.alfredo
      - icon: mdi:fan-remove
        conditions:
          - entity: vacuum.alfredo
            attribute: fan_speed
            value: Silent
        tooltip: Change fan speed
        tap_action:
          action: call-service
          service: vacuum.set_fan_speed
          service_data:
            entity_id: vacuum.alfredo
            fan_speed: Standard
      - icon: mdi:fan-speed-1
        conditions:
          - entity: vacuum.alfredo
            attribute: fan_speed
            value: Standard
        tooltip: Change fan speed
        tap_action:
          action: call-service
          service: vacuum.set_fan_speed
          service_data:
            entity_id: vacuum.alfredo
            fan_speed: Medium
      - icon: mdi:fan-speed-2
        conditions:
          - entity: vacuum.alfredo
            attribute: fan_speed
            value: Medium
        tooltip: Change fan speed
        tap_action:
          action: call-service
          service: vacuum.set_fan_speed
          service_data:
            entity_id: vacuum.alfredo
            fan_speed: Turbo
      - icon: mdi:fan-speed-3
        conditions:
          - entity: vacuum.alfredo
            attribute: fan_speed
            value: Turbo
        tooltip: Change fan speed
        tap_action:
          action: call-service
          service: vacuum.set_fan_speed
          service_data:
            entity_id: vacuum.alfredo
            fan_speed: Silent
      - icon: mdi:fan-alert
        conditions:
          - entity: vacuum.alfredo
            attribute: fan_speed
            value_not: Silent
          - entity: vacuum.alfredo
            attribute: fan_speed
            value_not: Standard
          - entity: vacuum.alfredo
            attribute: fan_speed
            value_not: Medium
          - entity: vacuum.alfredo
            attribute: fan_speed
            value_not: Turbo
        tooltip: Change fan speed
        tap_action:
          action: call-service
          service: vacuum.set_fan_speed
          service_data:
            entity_id: vacuum.alfredo
            fan_speed: Silent

Do you mean room outline on the map?

I see that you have clicked “Generate static config” button, why?

Do you use card mod?

Yes I pressed Generate static config. I thought this is necessary. What is generate static config for if you don’t need it?
Yes, I also installed card mod.

Well, it is needed if you want to manually adjust configuration of tiles/icons (instead of using generated one).

To change color of the room on the map you have to use following config of Map Extractor:

camera:
  - platform: xiaomi_cloud_map_extractor
    host: !secret xiaomi_vacuum_host
    token: !secret xiaomi_vacuum_token
    username: !secret xiaomi_cloud_username
    password: !secret xiaomi_cloud_password
    draw: ['all']
    attributes:
      - calibration_points
      - rooms
    room_colors:
      17: [255, 0, 0]

Here you have card’s code after reverting effects of “generate static config”:

square: true
columns: 3
type: grid
cards:
  - type: custom:xiaomi-vacuum-map-card
    map_source:
      camera: camera.xiaomi_cloud_map_extractor
    calibration_source:
      camera: true
    entity: vacuum.alfredo
    vacuum_platform: default
    map_modes:
      - template: vacuum_clean_zone
      - template: vacuum_goto
      - template: vacuum_clean_segment
        predefined_selections:
          - id: '16'
            icon:
              name: mdi:chef-hat
              x: 28815
              'y': 18278
            label:
              text: KĂźche
              x: 28815
              'y': 18278
              offset_y: 35
            outline:
              - - 27626
                - 19688
              - - 30045
                - 19704
              - - 30063
                - 16812
              - - 27626
                - 16841
              - - 27538
                - 17486
              - - 26863
                - 17486
              - - 26892
                - 18015
              - - 27628
                - 18103
              - - 27626
                - 19688
          - id: '17'
            icon:
              name: mdi:sofa
              x: 27626
              'y': 23592
            label:
              text: Wohnzimmer
              x: 27626
              'y': 23592
              offset_y: 35
            outline:
              - - 25073
                - 26791
              - - 30473
                - 26850
              - - 30503
                - 20451
              - - 27421
                - 20569
              - - 27421
                - 18807
              - - 25513
                - 18719
              - - 25454
                - 20334
              - - 20201
                - 20304
              - - 20142
                - 21420
              - - 25161
                - 21390
              - - 25073
                - 26791
          - id: '18'
            icon:
              name: mdi:teddy-bear
              x: 23600
              'y': 23592
            label:
              text: Kinderzimmer
              x: 23600
              'y': 23592
              offset_y: 35
            outline:
              - - 22461
                - 25382
              - - 24721
                - 25382
              - - 24721
                - 21508
              - - 22431
                - 21508
              - - 22461
                - 25382
          - id: '19'
            icon:
              name: mdi:broom
              x: 18700
              'y': 24475
            label:
              text: Room 19
              x: 18700
              'y': 24475
              offset_y: 35
          - id: '20'
            icon:
              name: mdi:broom
              x: 21400
              'y': 18850
            label:
              text: Room 20
              x: 21400
              'y': 18850
              offset_y: 35
          - id: '21'
            icon:
              name: mdi:broom
              x: 18800
              'y': 19600
            label:
              text: Room 21
              x: 18800
              'y': 19600
              offset_y: 35

Thanks, everything worked.

Hi,

I have configured in configuration.yaml the camera with the setting, but when I restart HA it´s restart very slowly.
I can control the Roborock S7 without any problem, but impossible keep the configuration, because Home assistant take a long time to restart

Please, let me know what I m doing wrong.

BR