Xiaomi Cloud Vacuum Map Extractor

It should look like this:

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   
    map_transformation:
      rotate: 180

Spaces matter. :slight_smile: Thanks again. would have taken me another day to figure it out.

oh yes, they do!

1 Like

of course

this is from Mattias_Persson.

Here a Popup yaml:

action: fire-dom-event
browser_mod:
  command: popup
  title: Staubsauger
  style:
    .: |
      :host .content {
        width: calc(385px + 300px + 300px);
        max-width: 90vw;
      }
    layout-card$grid-layout:
      $: |
        hui-vertical-stack-card {
          animation: border 1s forwards;
        }
        @keyframes border {
          0%, 100% {
              border-right: 1.5px solid rgba(0, 0, 0, 0.2);
          }
        }
        /* phone */
        @media screen and (max-width: 800px) {
          hui-vertical-stack-card {
              border-bottom: 1.5px solid rgba(0, 0, 0, 0.2);
              padding-right: 0;
              animation: none;
          }
        }
      $hui-vertical-stack-card:
        $: |
          hui-horizontal-stack-card {
            padding: 0em 2em 2.3em 2em;
          }
        $hui-entities-card$: |
          .card-content {
            padding: var(--card-content-padding);
          }
        $hui-horizontal-stack-card$: |
          #root {
            justify-content: space-evenly;
          }
      $hui-picture-elements-card$: |
        #root {
          animation: fadein 0.9s both;
        }
        @keyframes fadein {
          0% {
            opacity: 0;
          }
          75% {
            opacity: 0;
          }
          100% {
            opacity: 1;
          }
        }
  card:
    type: custom:layout-card
    layout_type: custom:grid-layout
    layout:
      grid-template-columns: 385px repeat(2, 300px)
      grid-template-rows: 1fr
      grid-template-areas: |
        "info map map"
      mediaquery:
        #phone
        "(max-width: 800px)":
          grid-template-columns: 1fr
          grid-template-rows: repeat(2, 1fr)
          grid-template-areas: |
            "info"
            "map"
    cards:

      #################################################
      #                                               #
      #                 Einstellungen                 #
      #                                               #
      #################################################

      - type: vertical-stack
        cards:
          - type: entities
            view_layout:
              grid-area: info
            title: Einstellungen
            card_mod:
              class: header
            entities:

            - entity: vacuum.roboter_staubsauger

            - entity: sensor.roboter_staubsauger_last_clean_end
                      
            - type: custom:bar-card
              width: 55%
              height: 2em
              decimal: 0
              unit_of_measurement: '%'
              positions:
                icon: outside
                indicator: 'off'
                name: outside
              severity:
                - color: '#303435'
                  from: 11
                  to: 100
                - color: '#6d2525'
                  from: 0
                  to: 10
              entity_row: true
              entities:
                - entity: vacuum.roboter_staubsauger
                  attribute: battery_level
                  name: Batterie
                  icon: mdi:battery

                - entity: sensor.template_vacuum_filter

                - entity: sensor.template_vacuum_mainbrush

                - entity: sensor.template_vacuum_sidebrush

                - entity: sensor.template_vacuum_sensors

            - entity: input_select.fan_speed

          - type: horizontal-stack
            cards:

              - type: custom:button-card
                entity: vacuum.roboter_staubsauger
                icon: mdi:play-pause
                tap_action:
                  action: call-service
                  service: >
                    [[[
                      return entity.state === 'docked' || entity.state === 'paused'
                        ? 'vacuum.start'
                        : 'vacuum.pause';
                    ]]]
                  service_data:
                    entity_id: >
                      [[[ return entity.entity_id; ]]]
                template: icon_only

              - type: custom:button-card
                entity: vacuum.roboter_staubsauger
                icon: mdi:battery-charging
                tap_action:
                  action: call-service
                  service: vacuum.return_to_base
                  service_data:
                    entity_id: >
                      [[[ return entity.entity_id; ]]]
                template: icon_only

              - type: custom:button-card
                icon: mdi:map-marker-question
                tap_action:
                  action: call-service
                  service: vacuum.locate
                  service_data:
                    entity_id: vacuum.roboter_staubsauger
                template: icon_only


      #################################################
      #                                               #
      #                 Karte                         #
      #                                               #
      #################################################


      - type: picture-elements
        title: Karte
        view_layout:
          grid-area: map
        image: /local/transparent_1to1.png
        card_mod:
          class: header
          style: |
            #root {
              animation: fade 1s both;
            }
            .card-header {
              margin: -0.05em 0 0 0.75em;
            }
            @keyframes fade {
              0% {
                opacity: 0;
              }
              50% {
                opacity: 0;
              }
              100% {
                opacity: 1;
              }
            }
        elements:

          - type: image
            camera_image: camera.roborock_s50
            style:
              top: 40%
              left: 50%
              width: 40%
              cursor: default
              background-position: center
              background-repeat: no-repeat
              background-size: cover
              transform: translate(-50%,-50%) scale(2.38,2.42)
              

          - type: custom:button-card
            name: Esszimmer
            tap_action:
              action: call-service
              service: script.turn_on
              service_data:
                entity_id: script.esszimmer
            show_label: false
            show_icon: false
            styles: &button-card-styles
              card:
              - padding: 3em
              - background: none
              name:
              - font-size: 0.9em
              - letter-spacing: 0.003em
              - color: '#aeb0b0'
              - background: '#191c1d80'
              - padding: 0.48em 0.78em 0.48em 0.78em
              - border-radius: 0.6em
              - overflow: visible
            style:
              left: 74%
              top: 25%      

          - type: custom:button-card
            name: Spielzimmer
            tap_action:
              action: call-service
              service: script.turn_on
              service_data:
                entity_id: script.kinderzimmer
            show_label: false
            show_icon: false
            styles: *button-card-styles
            style:
              left: 48%
              top: 60%

          - type: custom:button-card
            name: Wohnzimmer
            tap_action:
              action: call-service
              service: script.turn_on
              service_data:
                entity_id: script.wohnzimmer
            show_label: false
            show_icon: false
            styles: *button-card-styles
            style:
              left: 75%
              top: 60%

          - type: custom:button-card
            name: KĂźche
            tap_action:
              action: call-service
              service: script.turn_on
              service_data:
                entity_id: script.kueche
            show_label: false
            show_icon: false
            styles: *button-card-styles
            style:
              left: 49%
              top: 25%

          - type: custom:button-card
            name: Bad
            tap_action:
              action: call-service
              service: script.turn_on
              service_data:
                entity_id: script.badezimmer
            show_label: false
            show_icon: false
            styles: *button-card-styles
            style:
              left: 31%
              top: 25%



          - type: custom:button-card
            name: Gästezimmer
            tap_action:
              action: call-service
              service: script.turn_on
              service_data:
                entity_id: script.schlafzimmer
            show_label: false
            show_icon: false
            styles: *button-card-styles 
            style:
              left: 20%
              top: 60%




          - type: custom:button-card
            name: Flur
            tap_action:
              action: call-service
              service: script.turn_on
              service_data:
                entity_id: script.flur
            show_label: false
            show_icon: false
            styles: *button-card-styles
            style:
              left: 43%
              top: 41%



          - type: custom:button-card
            name: Eingang
            tap_action:
              action: call-service
              service: script.turn_on
              service_data:
                entity_id: script.eingang
            show_label: false
            show_icon: false
            styles: *button-card-styles
            style:
              left: 15%
              top: 41%







Lovelace:


      #################################################
      #                                               #
      #                    SIDEBAR                    #
      #                                               #
      #################################################

      - type: vertical-stack
        view_layout:
          grid-area: sidebar
        cards:
          - type: custom:button-card
            entity: sensor.template_sidebar
            template: sidebar_template

          - type: grid
            cards:
              - type: button
                icon: custom:roborock-vacuum
                tap_action:
                  !include popup/vacuum.yaml
                hold_action:
                  action: none

script(rooms):

script:

  'esszimmer':
    alias: esszimmer
    sequence:
    - data: {}
      entity_id: vacuum.roboter_staubsauger
      service: vacuum.pause
    - delay: 00:00:01
    - data:
        command: app_segment_clean
        entity_id: vacuum.roboter_staubsauger
        params:
        - 17
      entity_id: vacuum.roboter_staubsauger
      service: vacuum.send_command


  'wohnzimmer':
    alias: wohnzimmer
    sequence:
    - data: {}
      entity_id: vacuum.roboter_staubsauger
      service: vacuum.pause
    - delay: 00:00:01
    - data:
        command: app_segment_clean
        entity_id: vacuum.roboter_staubsauger
        params:
        - 16
      entity_id: vacuum.roboter_staubsauger
      service: vacuum.send_command



  'kueche':
    alias: kueche
    sequence:
    - data: {}
      entity_id: vacuum.roboter_staubsauger
      service: vacuum.pause
    - delay: 00:00:01
    - data:
        command: app_segment_clean
        entity_id: vacuum.roboter_staubsauger
        params:
        - 20
      entity_id: vacuum.roboter_staubsauger
      service: vacuum.send_command



  'kinderzimmer':
    alias: kinderzimmer
    sequence:
    - data: {}
      entity_id: vacuum.roboter_staubsauger
      service: vacuum.pause
    - delay: 00:00:01
    - data:
        command: app_segment_clean
        entity_id: vacuum.roboter_staubsauger
        params:
        - 1
      entity_id: vacuum.roboter_staubsauger
      service: vacuum.send_command



  'schlafzimmer':
    alias: schlafzimmer
    sequence:
    - data: {}
      entity_id: vacuum.roboter_staubsauger
      service: vacuum.pause
    - delay: 00:00:01
    - data:
        command: app_segment_clean
        entity_id: vacuum.roboter_staubsauger
        params:
        - 22
      entity_id: vacuum.roboter_staubsauger
      service: vacuum.send_command



  'badezimmer':
    alias: badezimmer
    sequence:
    - data: {}
      entity_id: vacuum.roboter_staubsauger
      service: vacuum.pause
    - delay: 00:00:01
    - data:
        command: app_segment_clean
        entity_id: vacuum.roboter_staubsauger
        params:
        - 18
      entity_id: vacuum.roboter_staubsauger
      service: vacuum.send_command


  'eingang':
    alias: eingang
    sequence:
    - data: {}
      entity_id: vacuum.roboter_staubsauger
      service: vacuum.pause
    - delay: 00:00:01
    - data:
        command: app_segment_clean
        entity_id: vacuum.roboter_staubsauger
        params:
        - 2
      entity_id: vacuum.roboter_staubsauger
      service: vacuum.send_command



  'flur':
    alias: flur
    sequence:
    - data: {}
      entity_id: vacuum.roboter_staubsauger
      service: vacuum.pause
    - delay: 00:00:01
    - data:
        command: app_segment_clean
        entity_id: vacuum.roboter_staubsauger
        params:
        - 19
      entity_id: vacuum.roboter_staubsauger
      service: vacuum.send_command

config map:


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
    country: de
    name: "Roborock S50"
    colors:
      color_map_outside: [0, 0, 0, 0]
      color_map_wall: [0, 0, 0, 0]
      color_map_wall_v2: [34, 35, 36]
      color_path: [84, 151, 240]
      color_charger: [8, 120, 36]
      color_robo: [255, 0, 0]
      color_scan: [0, 0, 0, 0]
      color_unknown: [0, 0, 0, 0]
      color_obstacle: [0, 0, 0, 0]
      color_grey_wall: [0, 0, 0, 0]
      color_ignored_obstacle: [0, 0, 0, 0]
      color_zones: [109, 37, 37]
      color_zones_outline: [0, 0, 0, 0]
      color_virtual_walls: [109, 37, 37]
      color_no_go_zones: [109, 37, 37]
      color_no_go_zones_outline: [0, 0, 0, 0]
      color_no_mop_zones: [109, 37, 37]
      color_no_mop_zones_outline: [0, 0, 0, 0]
    room_colors:
      1: [48, 52, 53]
      2: [48, 52, 53]
      16: [48, 52, 53]
      17: [48, 52, 53]
      18: [48, 52, 53]
      19: [48, 52, 53]
      20: [48, 52, 53]
      22: [48, 52, 53]
    draw:
      - charger
      - path
      - goto_path
      - predicted_path
      - no_go_zones
      - no_mopping_zones
      - vacuum_position
      - virtual_walls
      - zones
    map_transformation:
      scale: 3
      trim:
        top: 10
        bottom: 20
        left: 20
        right: 20
    scan_interval:
      seconds: 10
    auto_update: true

Edit:

templates:


    - unique_id: vacuum_filter
      icon: custom:roborock-filter
      unit_of_measurement: '%'
      state: >
        {{ (states('sensor.roboter_staubsauger_filter_left') | int(default=0) / 5400) | int(default=0) }}
      attributes:
        friendly_name: Filter

    - unique_id: vacuum_mainbrush
      icon: custom:roborock-mainbrush
      unit_of_measurement: '%'
      state: >
        {{ (states('sensor.roboter_staubsauger_main_brush_left') | int(default=0) / 10800) | int(default=0) }}
      attributes:
        friendly_name: KopfbĂźrste

    - unique_id: vacuum_sensors
      icon: custom:roborock-sensor
      unit_of_measurement: '%'
      state: >
        {{ (states('sensor.roboter_staubsauger_sensor_dirty_left') | int(default=0) / 1080) | int(default=0) }}
      attributes:
        friendly_name: Sensoren

    - unique_id: vacuum_sidebrush
      icon: custom:roborock-sidebrush
      unit_of_measurement: '%'
      state: >
        {{ (states('sensor.roboter_staubsauger_side_brush_left') | int(default=0) / 7200) | int(default=0) }}
      attributes:
        friendly_name: SeitenbĂźrste
1 Like

Hello everyone,

I’m actually new here and have the following problem:
if I uncomment this line ’ # font: “FreeSans.ttf” ’ in
xiaomi_cloud_map_extractor my server configuration remains invalid. How do I get this resolved? It seems that HA does not know this font!

Can someone help me with this please.

Thank you for your response.

There are problems with fonts that I haven’t found time to fix…

OK, thank you for your reply. :ok_hand: :ok_hand:

Hi,

unfortunately I encountered the problem (see snap below):

(and in yaml):
type: custom:xiaomi-vacuum-map-card
entity: vacuum.roborock_s7
map_source:
camera: camera.xiaomi_cloud_map_extractor
calibration_source:
camera: true
vacuum_platform: send_command
map_modes:

  • template: vacuum_clean_zone
  • template: vacuum_clean_zone_predefined

I’m not able to select the camera var from drop-list (it’s basically empty) while camera entity is visible in HA and it’s called: name: Xiaomi Cloud Map Extractor, id: camera.xiaomi_cloud_map_extractor

my configuration.yaml looks like that:
camera:

  • platform: xiaomi_cloud_map_extractor
    host: 192.168.xx.yyy
    token: xxx
    username: [email protected]
    password: doesn’t matter
    draw: [‘all’]
    attributes:
    • calibration_points

Check token against one from token extractor

it’s 1:1 …(I used ‘Get Mi home devices token’ for Win)

Can you control the vacuum from HA? Is there anything in logs?

Yes, I can (integrated by auto mode via Xiami Miio). I have 18 entities imported.

In regards to logs - I have found only one record:

Logger: homeassistant.components.camera
Source: helpers/entity_platform.py:718
Integration: Kamera (documentation, issues)
First occurred: 19:47:25 (1 occurrences)
Last logged: 19:47:25

Updating xiaomi_cloud_map_extractor camera took longer than the scheduled update interval 0:00:05

Hi again,

problem has been resolved. I just reset the Roborock :wink:

1 Like

My favourite kind of solution :smiley:

1 Like

Is there a way to assign the colors / variables from the used themes to the map? My goal is that when dark mode is activated, the map is displayed dark and when light mode is activated, the map is displayed light.

I have already tried something like this, but without success:
color_map_inside: "var(--color-main)"

Nope, it’s not possible

image
Hello everyone, Please help with my issue.
I got MOVA L600 or also dreame F9/D9, got vacuum card to work however map is not supported :sob:
What Can I do to make it work? Please help. Thank you

1 Like

How to add a second vacuum?
Thanks for this awesome integration!

I can’t seem to display the map of a second vacuum. The second vacuum (Roborock S4 Max) seems to integrate just fine with HA, but the xiaomi_cloud_map_extractor only shows the map for the first vacuum even though the second card is tied to the second vacuum.

Configuration looks like this:

camera:
  - platform: xiaomi_cloud_map_extractor
    host: 192.168.50.152
    token: my-token
    username: my-user
    password: my-pass
    draw: ["all"]
    attributes:
      - calibration_points
  - platform: xiaomi_cloud_map_extractor
    host: 192.168.50.137
    token: my-token
    username: my-user
    password: my-pass
    draw: ["all"]
    attributes:
      - calibration_points

I’ve also tried copying the config\custom_components\xiaomi_cloud_map_extractor to config\custom_components\xiaomi_cloud_map_extractor_new and trying:

camera:
  - platform: xiaomi_cloud_map_extractor
    host: 192.168.50.152
    token: my-token
    username: my-user
    password: my-pass
    draw: ["all"]
    attributes:
      - calibration_points
  - platform: xiaomi_cloud_map_extractor_new
    host: 192.168.50.137
    token: my-token
    username: my-user
    password: my-pass
    draw: ["all"]
    attributes:
      - calibration_points

With no luck.

The card yamls look like this:

type: custom:xiaomi-vacuum-map-card
map_source:
  camera: camera.xiaomi_cloud_map_extractor
calibration_source:
  camera: true
entity: vacuum.roborock_vacuum_s5
vacuum_platform: default
title: Roborock S5 Upstairs

and

type: custom:xiaomi-vacuum-map-card
map_source:
  camera: camera.xiaomi_cloud_map_extractor
calibration_source:
  camera: true
entity: vacuum.basement_vacuum
vacuum_platform: default
title: Roborock S4 Downstairs

What am I missing?