Integrating Xiaomi Mijia Switch with OpenHAB: A Smooth Experience

Integrating my Xiaomi Mijia Wireless Switch with OpenHAB has been a fantastic journey! Here’s how I made it work seamlessly:

  1. Setup and Pairing: I started by ensuring the openHAB MQTT binding was installed. Pairing the device with zigbee2mqtt was straightforward—just set permit_join to true in the configuration file. Once paired, I gave the device a friendly name and enabled experimental attribute output for better functionality.

  2. Configuration Details: My configuration involved setting up the MQTT broker and adjusting the zigbee2mqtt settings. The device ID was crucial, so I made sure to note it down for future reference. This setup allowed me to capture various click actions and durations, enhancing my automation possibilities.

  3. Integration with OpenHAB: I created a separate MQTT bridge configuration file for my Mosquitto broker. The zigbee.things file was then populated with the necessary channels to capture data like availability, battery level, voltage, link quality, and click actions. The items file linked these channels to OpenHAB items, making them accessible for rule creation.

  4. Rule Development: Using the DSL engine, I developed a rule to trigger actions based on different click types. Whether it’s a single click, double click, or a long press, the system responds accordingly. This flexibility has transformed my home into a smarter environment.

  5. User Interface: The sitemap was designed to provide a clear overview of the switch’s status and actions. It includes visual indicators for availability, battery levels, voltage, link quality, and the last click action. This setup ensures I can monitor everything at a glance.

  6. Tips for Success: - Ensure MQTT bindings are correctly installed. - Verify Mosquitto broker settings for smooth communication. - Regularly check battery levels for uninterrupted functionality.

This integration has been a game-changer for my smart home setup. The ability to customize actions based on different click types has made my home more responsive and user-friendly. If you’re looking to enhance your OpenHAB setup, integrating a Xiaomi Mijia switch is a fantastic way to start!