Xiaomi Vacuum cleaner Card

Did an upgrade of Valetudo to latest version 2021.02.0 on my 1st Gen vacuum and many things related to showing map were not working anymore and required many changes in HA configuration. I spent a lot of time on this, so sharing result to save some time for others.

I managed to get vacuum card working again plus I now have zone cleanup I always wanted.

Approach I described earlier is now obsolete. Everything now happens via MQTT instead of REST as before.

  1. On vacuum setup Valetudo MQTT settings with “Homeassistant Map Hack” turned off.

  2. In HA config add MQTT vacuum:

vacuum:
  - platform: mqtt
    name: "Servantess"
    schema: state
    supported_features:
      - start
      - pause
      - stop
      - return_home
      - battery
      - status
      - locate
      - clean_spot
      - fan_speed
      - send_command
    command_topic: "vacuum/servantess/command"
    state_topic: "vacuum/servantess/state"
    send_command_topic: "vacuum/servantess/custom_command"
    set_fan_speed_topic: "vacuum/servantess/set_fan_speed"
    fan_speed_list:
      - min
      - medium
      - high
      - max
  1. Install ICantBelieveItsNotValetudo HA addon and configure accordingly. This addon will generate map image received from vacuum on map_data MQTT topic and publish it on map topic for your camera.

  2. Add MQQT camera entity for ready map:

camera:
  - platform: mqtt
    name: Servantess Map
    topic: vacuum/servantess/map
  1. Finally update Lovelace card. Mine looks like that:
      - type: custom:mod-card
        title: Servantess
        card:
          type: picture-elements
          image: /local/images/transparent_background.png
          style: |
            ha-card {
              --primary-text-color: white;
              background-color: #155c9d;
              font-size: 1.3rem;
              font-style: bold
            }
          elements:
            - type: image
              entity: vacuum.servantess
              camera_image: camera.servantess_map
              style:
                top: 30%
                left: 50%
                width: 100%
            - type: icon
              icon: mdi:home
              style:
                top: 90%
                left: 20%
              tap_action:
                action: call-service
                service: vacuum.return_to_base
                service_data:
                  entity_id: vacuum.servantess
            - type: icon
              icon: mdi:play
              style:
                top: 90%
                left: 35%
              tap_action:
                action: call-service
                service: vacuum.start
                service_data:
                  entity_id: vacuum.servantess
            - type: icon
              icon: mdi:deathly-hallows
              style:
                top: 90%
                left: 50%
              tap_action:
                action: call-service
                service: vacuum.send_command
                service_data:
                  entity_id: vacuum.servantess
                  command: 'zoned_cleanup'
                  params:
                    'zone_ids': ['85312723-5b9e-4d45-9d33-09aaadc3ee9d']
            - type: icon
              icon: mdi:stop
              style:
                top: 90%
                left: 65%
              tap_action:
                action: call-service
                service: vacuum.stop
                service_data:
                  entity_id: vacuum.servantess
            - type: icon
              icon: mdi:crosshairs-gps
              style:
                top: 90%
                left: 80%
              tap_action:
                action: call-service
                service: vacuum.locate
                service_data:
                  entity_id: vacuum.servantess
            - type: state-label
              entity: sensor.servantess_state_label
              style:
                bottom: 12%
                left: 1%
                color: rgb(255, 255, 255)
                transform: translate(0%,-50%)
                pointer-events: none
                text-shadow: 1px 1px black
                font-family: Trebuchet MS
                font-size: 90%
                font-weight: bold
                opacity: 0.8
            - type: state-label
              entity: sensor.servantess_cleanup_count_label
              style:
                bottom: 12%
                right: 1%
                color: rgb(255, 255, 255)
                transform: translate(0%,-50%)
                pointer-events: none
                text-shadow: 1px 1px black
                font-family: Trebuchet MS
                font-size: 90%
                font-weight: bold
                opacity: 0.8

When verified it works cleanup related outdated stuff.

3 Likes

Amazing work!
Will try it soon.

I’ll also try combining this card with the interactive map one (Xiaomi Vacuum Interactive Map Card): That combination of both would be the definitive card for vacuums.

BTW since you own a xiaomi STYJ02YM did you find the service call necessary to automatically repeat the vacuum cycle once it finishes?

Do you have the English translated version by chance?
I’d like to give this a shot.
Thanks