Successfully Configuring Zigbee2MQTT Auto Permit Join in openHAB

Hey everyone,

I wanted to share a quick success story I had with configuring Zigbee2MQTT in openHAB. I’ve been working on setting up my smart home for a while now, and one thing that always annoyed me was manually enabling and disabling the permit join feature every time I wanted to add a new device. It felt a bit clunky and not very seamless, especially when I was in the middle of setting things up.

After some research and trial and error, I stumbled upon a neat solution that automates the permit join process. Essentially, I created a custom switch within openHAB that allows me to toggle the permit join feature for a set amount of time—20 seconds in my case. Once the time is up, Zigbee2MQTT automatically disables it again. This has been a game-changer for me!

Here’s a quick rundown of what I did:

  1. Installed Zigbee2MQTT: If you haven’t already, make sure Zigbee2MQTT is properly integrated into your openHAB setup. I followed the official documentation, which was pretty straightforward.

  2. Created a Generic MQTT Thing: In openHAB, I set up a new thing that communicates with Zigbee2MQTT. I configured the availability and unavailability payloads to ensure everything stays connected.

  3. Configured the Switch Channel: Under the thing’s channels, I added a switch type channel. The key here was setting the state and command topics correctly. I used zigbee2mqtt/bridge/info for the state and zigbee2mqtt/bridge/request/permit_join for the command. For the on and off values, I used true and false, respectively.

  4. Added Incoming and Outgoing Transformations: To make sure everything communicates smoothly, I added a JSONPATH transformation to extract the permit_join value. On the outgoing side, I formatted the command to include the desired time in seconds.

  5. Linked to a Switch Item: Finally, I linked this channel to a switch item in my sitemap. Now, I have a neat toggle button in my Basic UI that I can use to enable permit join whenever I need to add a new device.

This setup has saved me so much time and frustration. No more manually editing configuration files or worrying about leaving permit join enabled too long. It’s just one less thing to think about when setting up my smart home.

I’d love to hear if anyone else has tried something similar or has tips for improving this setup. Happy automating! :blush: