Successful Integration of Xiaomi Devices with OH3: A Step-by-Step Guide

I’ve recently gone through the process of integrating my Xiaomi devices with OpenHAB 3, and I wanted to share my experience in case it helps others who are facing similar challenges. While the official documentation is a bit outdated, I managed to get everything working with some trial and error. Here’s how I did it:

1. Gathering the Tools
First, I made sure I had all the necessary hardware. I used a Raspberry Pi 4 with OpenHAB 3.1.0 installed, a CC2531 Zigbee stick, and a working MQTT broker. I also set up Zigbee2MQTT since it’s a great intermediary for handling Zigbee devices.

2. Pairing the Devices
I started by pairing my Xiaomi water leak sensor and switch with the CC2531 stick. This was straightforward using the Zigbee2MQTT console. The devices showed up in the console, and I could see their parameters right away.

3. Connecting to MQTT
Next, I configured OpenHAB to connect to the MQTT broker. This involved setting up the necessary rules and bindings in the configuration files. I used Mqtt.fx to monitor the broker and ensure that the devices were publishing their data correctly.

4. Troubleshooting
One issue I encountered was that the devices weren’t showing up in OpenHAB. After some research, I realized that I needed to manually add the device IDs to the OpenHAB configuration. This was a bit tedious, but it worked once I got the hang of it.

5. Final Setup
Once everything was connected, I set up some basic rules to automate my devices. For example, I programmed the water leak sensor to send an alert to my phone if it detects water. This gives me peace of mind, especially when I’m away from home.

6. Key Takeaways

  • Patience is Key: Integrating Zigbee devices with OpenHAB can be tricky, but it’s worth the effort.
  • Community Support: Don’t hesitate to reach out to forums or communities like this one. Someone has likely faced the same issue and can offer guidance.
  • Documentation: While the official docs might be outdated, resources like Zigbee2MQTT’s GitHub page are invaluable.

If anyone has questions or needs help, feel free to ask! I’m happy to share more details about my setup or troubleshoot issues together.

Happy automating! :rocket: