Hello fellow smart home enthusiasts! I’ve been diving into some MQTT configurations lately and wanted to share my experience in case it helps anyone else. I was trying to set up a REGEX transformation for an MQTT channel but kept running into issues. Here’s what I learned:
The Issue:
I had an MQTT topic that was publishing values like 3 - Comfort, and I wanted to strip out the 3 - part to just get Comfort as the item state. I tried using a REGEX transformation in my channel definition, but it wasn’t working as expected.
The Solution:
After some research and trial and error, I figured out that the REGEX pattern needed to be adjusted. Instead of trying to capture everything after the hyphen, I needed to match the entire string and extract the part after the hyphen. Here’s the corrected channel definition:
plaintext
Type string : bsblan_heating_circuit_1_operating_mode “Heating circuit 1 operating mode” [ stateTopic=“BSB-LAN/700”, transformationPattern=“REGEX: (\d+ - )(\w+)”, transformationFallback=“unknown” ]
This pattern captures the number and hyphen as the first group and the operating mode as the second group. The transformationFallback ensures that if the pattern doesn’t match, it defaults to unknown instead of causing an error.
Testing It Out:
Once I updated the channel definition, I tested it by publishing 3 - Comfort to the topic. The item correctly updated to Comfort. It’s been working smoothly ever since!
Zigbee Binding Tip:
While I was at it, I also looked into setting up Zigbee devices with openHAB. One thing that tripped me up initially was ensuring that the Zigbee binding was properly configured. If you’re having trouble discovering devices, make sure that:
- Your Zigbee USB stick is properly connected and recognized by the system.
- The Zigbee binding is installed and enabled in PaperUI.
- You’ve given the binding a few minutes to scan for devices.
If you’re still not seeing your devices, try resetting the Zigbee network in PaperUI and pairing your devices again. Sometimes a fresh start helps!
Final Thoughts:
Smart home setups can be a bit tricky, but with a little patience and some community support, you can work through most issues. If anyone else is struggling with REGEX transformations or Zigbee bindings, feel free to reach out—I’d be happy to help!
Happy automating! ![]()