Xiaomi Vacuum cleaner Card

Does anyone know how to reset the maintenance times from outside the xiaomi app? It would be a nice addition to reset them directly from HomeAssistant vacuum card.

I think Valetudo can do this.

It seems like the structure of [tap-action] has changed, I scratched my head for a while trying to figure out why the call-service actions where not working. It was not until I checked the documentation for the Picture Element that I realized what was wrong: https://www.home-assistant.io/lovelace/picture-elements/#icon-representing-an-entity-state

Following the documentation, you have to modify the tap-action section for each icon. Let’s take the icon for locating the vacuum for example, in the posted configuration looks like this:

- type: icon
  icon: mdi:bell-ring
  tap_action: call-service
  entity: vacuum.xiaomi_vacuum_cleaner
  service: vacuum.locate
  style:
    top: 80%
    left: 80%
    "--paper-item-icon-color": rgb(115, 122, 130)

According to the current documentation it should look like this:

- type: icon
  icon: mdi:bell-ring
  tap_action:
    action: call-service
    service: vacuum.locate
    service_data:
      entity_id: vacuum.xiaomi_vacuum_cleaner
  style:
    top: 80%
    left: 80%
    "--paper-item-icon-color": rgb(115, 122, 130)

I also saw some examples using [service: vacuum.start_pause] but that service doesn’t exist for the xiaomi vacuum, [vacuum.start] and [vacuum.pause] do work/exist but not [vacuum.start_pause].
I hope that helps.

3 Likes

Thank you so much. Finally found the answer to why all my tap_actions stopped working!

I am glad my comment was of some help… We have to keep an eye on the Lovelace release notes.

For now… custom_component xiaomi_clean_zone_start here Zone cleaning parameters - Xiaomi vacuum

2 Likes

I also saw the icon formatting was wrong, working now.
But I do have the service “vacuum.start_pause”, and I have a Xiaomi Vacuum.

EDIT: I see I have the service in my list but activating it doesn’t work… So you’re right!
Did it like this now, with 5 buttons

      - type: vertical-stack
    cards:              
      - type: picture-elements
        image: /local/vacuum_card.jpg
        elements:
        - type: icon
          icon: mdi:bell-ring
          tap_action:
            action: call-service
            service: vacuum.locate
            service_data:
              entity_id: vacuum.bumper
          style:
            top: 80%
            left: 90%
            --iron-icon-fill-color: blue
        - type: icon
          icon: mdi:home
          tap_action:
            action: call-service
            service: vacuum.return_to_base
            service_data:
              entity_id: vacuum.bumper          
          style:
            top: 80%
            left: 70%
            --iron-icon-fill-color: blue
        - type: icon
          icon: mdi:stop
          tap_action:
            action: call-service
            service: vacuum.stop
            service_data:
              entity_id: vacuum.bumper           
          style:
            top: 80%
            left: 50%
            --iron-icon-fill-color: blue
        - type: icon
          icon: mdi:pause
          tap_action:
            action: call-service
            service: vacuum.pause
            service_data:
              entity_id: vacuum.bumper            
          style:
            top: 80%
            left: 30%
            --iron-icon-fill-color: blue
        - type: icon
          icon: mdi:play
          tap_action:
            action: call-service
            service: vacuum.start
            service_data:
              entity_id: vacuum.bumper            
          style:
            top: 80%
            left: 10%
            --iron-icon-fill-color: blue 

Also, with the previous yaml I couldn’t get the icons to change color. With the " --iron-icon-fill-color: blue " it works.

I am a novice in HA, so I am asking for forgiveness :slight_smile:

  1. Does someone know how to do it by clicking on STAN-LABEL (w stacji dokującej) to show me more information?
  • type: state-label
    tap_action: more-info
    entity: vacuum.xiaomi_vacuum_cleaner
  1. In both the Vacuum card and the weather card, it shows information from a lowercase letter. What do I need to set up to start sentences with a capital letter?

1
I will be grateful for your help.

From console you can do that with the mirobo console tool (see https://python-miio.readthedocs.io/en/latest/vacuum.html#mirobo-reset-consumable and mirobo reset-consumable --help).

To do the same from homeassistant directly, the easiest way at the moment is to use vacuum.send_command, e.g. vacuum.send_command with command reset_consumable (https://github.com/rytilahti/python-miio/blob/master/miio/vacuum.py#L178) and with the parameter sensor_dirty_time (available names for the parameter can be seen in https://github.com/rytilahti/python-miio/blob/master/miio/vacuum.py#L35).

3 Likes

For a simplistic UI I can recommend this, iirc it was good to go after replacing the image: https://www.reddit.com/r/homeassistant/comments/9op70r/neato_picture_elements_card/ :slight_smile:

1 Like

I took your card, changed the colors a little bit to make it a little more readable and also modified the tap_action to the new structure laid out in the docs.
Mi ui-lovelace.yaml is in github if anyone wants it. Here is a picture of the card:

Vacuum_Card

hey @gurbina93

thanks for this.

quick question? are you still able to use the custom:vertical-stack-in-card in 0.86.1? I am trying your code out in the on screen lovelace editor i.e. not the ui-lovelace.yaml and I get this error :

YAML Error: TypeError: Cannot read property 'startsWith' of undefined

Any ideas?

Hello, I love this but I am struggling to get the actions to work. I have stripped everything out and just have the start button and I click and nothing happens. Any idea please? on the latest version of HA

elements:
  - type: icon
    icon: 'mdi:play'
    tap_action:
      action: call_service
      service: vacuum.start
      service_data:
        entity_id: vacuum.renvac
    style:
      color: '#000000'
      left: 20%
      top: 90%
image: /local/lovelace/xiaomi-roborock.png
title: Vacuum
type: picture-elements

Action should be call-service, a dash instead of the underscore you currently have.

1 Like

Hey, I took ur card and added it, but the operation or maintaince information wont show up in that card :confused:
Do you know why?

@gurbina93 did you manage to sort out your code ?

You need to setup the template sensors from this file: https://github.com/jardiamj/homeassistant/blob/master/sensors.yaml

Question to your automations; The “automatic start” and “daily cleaning”, you have set this as a condition " as_timestamp(utcnow()) + 1200 - as_timestamp(states.vacuum.xiaomi_vacuum_cleaner.last_updated) > 10080 " what does it mean?

1 Like

I trigger the vacuum as soon no one is at home. But I want to avoid that the vacuum is triggered every hour or so.
Therefore I trigger the vacuum as soon no one is at home and the last clean was done more then 4 hours before.

I’ve created a more theme-friendly transparant background picture. You can find it here

https://dsc.cloud/razzi/vacuum_gray.png