Xiaomi Vacuum cleaner Card

HI @Hellcube can you confirm which integration you use for the vacuum ? miio2 ?

I was able to do some integration you do but not all
like LED, locate seems not working on my vacuum styj02ym

Also all infos like filter, mop not show information

Thanks for your help

Capture-d-e-cran-2020-07-13-a-15-34-31

i have used miio2.

Hello comunity.
I cannot manage to launch the vacum script with the card.
Here is my script:

salle_a_manger:
  alias: test
  icon: mdi:table-chair
  sequence:
  - data:
      command: app_zoned_clean
      params:
      - - 23081
        - 20668
        - 28131
        - 27218
        - 1
    entity_id: vacuum.xiaomi_vacuum_cleaner
    service: vacuum.send_command

And here th code for de card:

actions:
  - icon: 'mdi:table-chair'
    name: test
    Service: script.00000000000001
  - icon: 'mdi:silverware-fork-knife'
    name: Cuisine
    service: script.Cuisine
  - icon: 'mdi:shoe-formal'
    name: Couloir
    service: script.Couloir
  - icon: 'mdi:sofa'
    name: Salon
    service: script.salon
entity: vacuum.xiaomi_vacuum_cleaner
stats:
  cleaning:
    - attribute: cleaned_area
      subtitle: Cleaning area
      unit: m2
    - attribute: cleaning_time
      subtitle: Cleaning time
      unit: minutes
  default:
    - attribute: filter_left
      subtitle: Filter
      unit: hours
    - attribute: side_brush_left
      subtitle: Side brush
      unit: hours
    - attribute: main_brush_left
      subtitle: Main brush
      unit: hours
    - attribute: sensor_dirty_left
      subtitle: Sensors
      unit: hours
type: 'custom:vacuum-card'

image
But when i click the button nothing happen.

1 Like

Hi there!
Here is my Xiaomi Vacuum clean Card.

If you like it, it’s available here:

3 Likes

So what part is the code? It looks amazing but i can’t find it on the github @Abeksis

Hola.
Conseguiste arreglar el problema del valor del fan_speed.
Yo poseo el mismo problema.
Un saludo.

Link fixed (moved to pastebin.com old pastebin.pl is down).

Hello
I have a problem, it does not work until the end, the card does not work, the buttons and the selection of rooms, which may be caused by I did according to the instructions

Did You add this to You configuration.yaml?

input_select:
  vacuum_room:
    name: Choose a room
    options:
      - Which room to vacuum
      - Room1
      - Room2
      - Room3
      - Room4

so added and the buttons only work start, stop, pauza, go to Home

Friends! How to “geolocate” the vacuum cleaner in the form of a list if the coordinates of the rooms are known?
For example, if the robot is in zone [11111, 22222, 33333, 4444, 1] while cleaning, the message “Bedroom” is returned, [55555, 66666, 77777, 88888, 1] - “Living room”, etc.?

Great job @Hellcube.
Maybe its stupid question, but why I have black colour of font?

And same situation like others, not all integration worked for me.
Do You guys have some solution for that?

obraz

Im using black theme (custom) so the font color is changed to white as default.
If you use the standard theme it is black default.
You would have to add (color: white;) to your style…

Thank You @Hellcube
i noticed it after a while a changed color to white. But im strugling still with fan speed button and brushes % values. To be sure, You are using code that You posted here, You have styj02ym and You are using this GitHub - nqkdev/home-assistant-vacuum-styj02ym code to connect to it (maybe You fored it and changed something, or used from another source)? Because i dont know where I have error with that:(
Once again thank You for help.

@Hellcube
I have Xiaomi Vacuum Mop Pro / STYJ02YM i used your code and it looks amazing.
But I have problem with using “Choose room option” neverthless what I choose it starts cleaning whole flat. If i go to Configuration->Scripts and run single script It goes to selected room (had to test some numbers to get correct rooms but now it’s ok)
Also I am not sure but looks like 1,2,3 icons do nothing.

Edit: Ok I have managed this problem (propably wrong YAML formatting - no errors but problems).
Now it works

When I go to services and fill in:

service: Vacuum.send_command
Entity: vacuum.name

And as service data:

{
  "entity_id": "vacuum.name",
  "command": "reset_consumable",
  "params": [main_brush_work_time]
}

This does work like a charm.

But I want to have a button in Home Assistant to perform this action, and I can’t get it to work.

This is my script:

  vacuummainbrush:
    alias: "Reset main brush"
    sequence:
      - service: vacuum.send_command
        data_template:
          entity_id: vacuum.name
          command: reset_consumable
          params: main_brush_work_time

So… What I did at this time to get this working:

Made a script in scripts.yaml:

 vacuummainbrush:
    alias: "vacuummainbrush"
    sequence:
      - service: vacuum.send_command
        data_template:
          {
            "entity_id": "vacuum.sucker",   # Don't mind my vacuum's name :)
            "command": "reset_consumable",
            "params": [main_brush_work_time]
          }

And I did add this to my card:

type: horizontal-stack
cards:
  - type: entity-button
    name: Borstel
    entity: script.vacuummainbrush
    icon: 'mdi:broom'
    tap_action:
      action: call-service
      service: script.vacuummainbrush

This way you can have multiple entity-buttons to run the script next to each other.

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