Integrating Xiaomi Vacuum Cleaner with Home Assistant: A Step-by-Step Guide

Hello everyone, I recently decided to integrate my Xiaomi vacuum cleaner into my Home Assistant setup, and I thought I’d share my experience and some tips for anyone else looking to do the same.

First off, I’ll start by saying that the process wasn’t as straightforward as I hoped, but with a bit of research and some trial and error, I managed to get everything working smoothly. Here’s how I did it:

Setting Up the Configuration

I began by adding the Xiaomi Miio platform to my configuration.yaml file. This was pretty straightforward, and I followed the official documentation to set it up. Here’s what my configuration looked like:

yaml
vacuum:

  • platform: xiaomi_miio
    host: 192.168.1.27
    token: YOUR_SECRET_TOKEN

I made sure to replace YOUR_SECRET_TOKEN with the actual token from my vacuum cleaner. This token can usually be found in the Mi Home app under the device settings.

Creating a Vacuum Group

Next, I wanted to create a group for my vacuum cleaner in group.yaml so that I could easily control it from the dashboard. Here’s the code I used:

yaml
nigel_vacuum:
name: Nigel
control: hidden
view: yes
entities:
- vacuum.xiaomi_vacuum_cleaner

This setup allows me to see the vacuum’s status and control it without cluttering my dashboard with unnecessary details.

Displaying Vacuum Information

One thing I really wanted was to display more detailed information about my vacuum, such as the battery level and cleaning time. I used template sensors to achieve this. Here’s an example of how I set it up:

yaml
sensor:

  • platform: template
    sensors:
    vacuum_battery_level:
    value_template: “{{ states.vacuum.xiaomi_vacuum_cleaner.attributes.battery_level }}”
    friendly_name: Battery Level

This sensor now shows the battery level of my vacuum on my dashboard, which is super handy!

Troubleshooting Tips

  • Connection Issues: If your vacuum isn’t connecting, make sure it’s on the same network as your Home Assistant instance. Sometimes, firewall settings or router configurations can block the connection.
  • Token Errors: Double-check your token. Even a small typo can prevent the integration from working.
  • Firmware Updates: Ensure your vacuum’s firmware is up to date. Sometimes, outdated firmware can cause compatibility issues.

Final Thoughts

Integrating my Xiaomi vacuum cleaner with Home Assistant has been a fantastic addition to my smart home setup. It’s not just about convenience; it’s about having everything in one place where I can control and monitor my devices effortlessly. If you’re thinking about doing the same, I highly recommend giving it a try!

Happy automating everyone! :rocket: