Connecting AHC9000 to OpenHAB via MQTT: A Comprehensive Guide

After months of trial and error, I finally managed to connect my AHC9000 (Jablotron AC-116) to OpenHAB using MQTT. This journey was challenging, but the satisfaction of seeing everything work seamlessly is immense. Here’s a detailed breakdown of how I achieved this, in case anyone else is struggling with similar issues.### The ChallengeI initially tried connecting the AHC9000 directly to OpenHAB using a Modbus (RS485 Serial interface) on a Raspberry Pi. Despite numerous attempts, I couldn’t get it to work. Frustrated but determined, I decided to explore alternative methods.### The Solution: MQTT via ESP8266I stumbled upon a fantastic GitHub project by DKJonas, which uses an ESP8266 module to create an MQTT interface for the AHC9000. This approach proved to be the missing piece of the puzzle. Here’s how I implemented it:#### Materials Needed- ESP8266 Module: For each AHC9000 you want to connect.- UART to RS485 Converter: Ensure it’s 3.3V compliant.- 24V to 3.3V SMPS: To power the ESP8266.- Veo-Board: For assembling the circuit.- Wires and Pin-headers: For connecting the components.#### Step-by-Step Setup1. Download and Flash the ESP8266 Code - Visit DKJonas’ GitHub repository and download the Arduino code and schematic. - Use VS Code with PlatformIO to flash the code onto the ESP8266 module.2. Assemble the Circuit - Follow the schematic to solder the components onto the Veo-board. This step requires some soldering skills but is manageable with patience.3. Install MQTT Broker on OpenHAB - Access your OpenHAB system via SSH or VNC. - Under “Optional Components,” install the “Mosquitto broker.” You’ll be prompted to set a username and password for the broker.4. Configure OpenHAB - Create a new .things file in the OpenHAB configuration directory to define the MQTT bridge. - Set up items and rules to interact with the AHC9000. For example, you can monitor temperatures, adjust setpoints, and control solenoids.5. Test the Integration - Use a tool like mosquitto_sub to subscribe to the MQTT topics and ensure data is being published correctly. - Check the OpenHAB dashboard to verify that all channels are functioning as expected.### Challenges Faced- Configuration Complexity: The GUI for MQTT setup in OpenHAB3 was not intuitive, leading to several loops of trial and error.- Feedback Issues: The system didn’t provide clear feedback when something went wrong, making troubleshooting challenging.### Tips for Success- Use Text Configuration: If the GUI isn’t working for you, switch to text-based configuration. Tools like Frontail can provide valuable feedback.- Start Small: Begin by configuring a single room or sensor to ensure everything works before scaling up.### ConclusionThis project was a significant learning curve, but it’s rewarding to see the AHC9000 fully integrated into my smart home ecosystem. I hope this guide helps others avoid the pitfalls I encountered and streamlines their setup process. Happy tinkering! :rocket: