How to integrate xiaomi vaccum with Valetudo to Home Assistant?

Hi,
I flashed my xiaomi vacuum robot (1.Gen) with Valetudo. And it will work great! But how do I connect the robot with Home Assistant?
I try it with the MQTT Vacuum integration.

My config in configuration.yaml:

vacuum:
  - platform: mqtt
    name: "Staubi"
    supported_features:
      - turn_on
      - turn_off
      - pause
      - stop
      - return_home
      - battery
      - status
      - locate
      - clean_spot
      - fan_speed
      - send_command
    command_topic: "vacuum/command"
    battery_level_topic: "vacuum/state"
    battery_level_template: "{{ value_json.battery_level }}"
    charging_topic: "vacuum/state"
    charging_template: "{{ value_json.charging }}"
    cleaning_topic: "vacuum/state"
    cleaning_template: "{{ value_json.cleaning }}"
    docked_topic: "vacuum/state"
    docked_template: "{{ value_json.docked }}"
    error_topic: "vacuum/state"
    error_template: "{{ value_json.error }}"
    fan_speed_topic: "vacuum/state"
    fan_speed_template: "{{ value_json.fan_speed }}"
    set_fan_speed_topic: "vacuum/set_fan_speed"
    fan_speed_list:
      - min
      - medium
      - high
      - max
    send_command_topic: 'vacuum/send_command'

So I installed the Mosquitto broker AddOn with this config:

{
  "logins": [{"username": "local-user", "password": "mypw"}],
  "anonymous": false,
  "quiet_logs": true,
  "customize": {
    "active": false,
    "folder": "mosquitto"
  },
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem"
}

Then I adapt the config.json file on the robot like this:

{
  "spots": [],
  "areas": [],
  "mqtt": {
    "enabled": false,
    "identifier": "rockrobo",
    "topicPrefix": "valetudo",
    "autoconfPrefix": "homeassistant",
    "broker_url": "mqtt://local-user:[email protected]",
    "mapSettings": {
      "drawPath": true,
      "drawCharger": true,
      "drawRobot": true,
      "border": 2,
      "scale": 4
    }
  },
  "dummycloud": {
    "spoofedIP": "203.0.113.1",
    "bindIP": "127.0.0.1"
  },
  "map_upload_host": "http://127.0.0.1"
}

After that, I reboot the robot and home asstant and the vacuum entity appears in Home Assistant- but it doesn’t work. I can’t start the robot or anything else.

What do I wrong? Has anyone a working solution?

I’m using Hass.io on a Raspberry Pi3

Thanks for your help!

2 Likes

Ohhhh my fault!!!
I have to set enabled to true!

"mqtt": {
    "enabled": true,

Sorry

I’m new to all this, but I have my vacuum working with Valetudo. I just installed Hass.io on a Pi3 but I can’t seem to get it to work. I installed the MQTT mosquitto thing and I can “turn on” and “turn off” the basic commands via die MQTT discovery of the entities.

But I can’t seem to get it to (1) clean a zone and (2) go to a spot, because that requires the send_command entity with data and it doesn’t seem to work.

I tried using this guide: https://github.com/Hypfer/Valetudo/wiki/Home-Assistant-Integration
But the HA UI is super confusing to me (I’m an engineer that understands the Kubernetes UI… If I can’t figure things out, it means there is some UX problem…).
How do I use the service data stuff?

I made a xmpp notify with all details

Would you mind sharing your vacuum automation please?

Yes please share the notification automation! Would be awesome :smiley:

Do you have xmpp component ?

Recent updates to Valetudo has removed the zone cleanup function for Gen1 Xiaomi Roborock Vacuums. However since Valetudo 2021.06.0 REST command are available. To get the zone cleanup function working again you can do the following:

Create zones as needed in the vacuum’s Valetudo interface. Click the information icon when creating the zone and record the zone ID.

In configuration.yaml add a rest command as follows replacing the zone ID which is at the end of the url with your own:

rest_command:
  vacuum_kitchen:
    url: 'http://192.168.1.195/api/v2/robot/capabilities/ZoneCleaningCapability/presets/fb3e756b-7f29-47c1-98fc-caa64a9bdb85'
    method: put
    headers:
      accept: "*/*"
    content_type: "application/json"
    payload: '{"action": "clean"}'