Successfully Fixing Xiaomi Window Sensor Display Issue and MySQL Persistence Setup Tips

Recently, I encountered an issue with my Xiaomi window sensors where they weren’t displaying correctly in the Paper UI or Visual Studio Code. Despite successful pairing and functionality, the sensors showed ‘NULL’ or ‘–’ in the UI. After some troubleshooting, I discovered the problem was related to the JSONPATH transformation in the generic binding configuration. The warning message in the log indicated an invalid path, which I corrected by adjusting the JSONPATH expression to match the actual sensor data structure. This resolved the display issue, and now the sensors work seamlessly in my setup.

For those interested in enhancing their openHAB setup, I also wanted to share a quick tip about MySQL persistence. I recently configured MySQL to store my openHAB data, which allows for better data management and historical analysis. Here’s a simplified guide:

  1. Install MySQL: Use sudo apt-get install mysql-server and set up your root password.
  2. Create Database and User: Connect to MySQL and create a database named ‘OpenHAB’ with a user having full privileges.
  3. Configure openHAB: Update the persistence file to use the MySQL database and define your logging strategies.
  4. Restart Services: Ensure openHAB restarts to apply changes.

This setup has been working reliably for me, and I encourage others to explore MySQL persistence for their projects. If anyone has questions or tips, feel free to share! Happy automating! :slight_smile: