I placed an order with Aliexpress a few months ago and every few days something new show’s up,:sunglasses: like a CC2531 Usb sniffer. I flashed CC2531ZNP-Prod.hex, installed zigbee2mqtt from https://github.com/Koenkk/zigbee2mqtt.git, started it up and found a device (one of my two lights). Sent an mqtt message from my PC, and voila, the light turns on and off. Created an item in OH with mqtt info, but no luck, not even a light state. BTW, Everything is installed and running on a separate RPI than OH.

I read through several pages of info, seems this is geared more towards hassio, but didn’t find much that helped. This forum has a few topics but most are dealing with transformation and I did make several transform attempts. So, for those that are using the same CC2531 and zigbee2mqtt, on or with OH, I have a few questions.

Are there specific settings of zigbee2mqtt, in the configuration.yaml or any other file, that require special changes to communicate with OH?

Have I flashed the USB with the correct firmware (CC2531ZNP-Prod.hex) ?

Should or would this work better with the USB stick/coordinator installed on the same RPI as OH? If so, is there anything else that needs to be installed such as zigbee2mqtt, like installed above?

Will Zigbee or some other binding need to be installed? FYI I have all the recommended transformation bindings and mqtt installed.

I only have two lights that OH can’t control, one Sengled the other a Hue, so far Alexa (it’s the Alexa echo plus w/ built in zigbee hub) has done a fine job picking up the slack.:wink: That said, I noticed when testing zigbee2mqtt (I was using the Sengled bulb) that Alexa can no longer control or connect with the bulb. Is this normal?

So far, I believe that’s all the questions I have.

Thanks in advance.

1 Like

Do you have specific problems you’re running in to?
If you had the stick working before with Z2M than the firmware is correct.
I’m having a hardtime following what you did from your original test. Did you move the stick to an Rpi?

For my setup I just installed Mosquitto, Installed the MQTT binding in to OH2. Configured both so what they are talking together. The MQTT tutorial shows you how to set up dummy items for testing.

I used MQTT-SPY to check the communication between OH2 and Mosquitto.

Then I set up the Z2M bridge following their instructions. Make sure in the Yaml you configure Z2M to connect to mosquitto. Again you can test it using MQTT-SPY.

After that it’s a matter of just setting up the items and the correct subscription topics for the items and it should work.

Thank for the reply @tebore. My issue is not being able to control the device via OH. The usb stick has not been moved, it’s on an RPI, but not the same RPI I’m running OH on.

I have both installed and working. Mqtt is how 90% of my home automation communicates.

I followed the same instructions for setting up the bridge. Are you using the USB stick on the same machine that’s running OH? I ask b/c I’m not sure what the yaml config should look like when the usb is on a separate machine or does it matter?

I tested using mosquito on both my PC and via ssh terminal on RPI (that’s running OH). I just can’t seem to make OH work via item file. I ask all the questions b/c, at bare minimum I should be able to get the state of an item.

Here’s the last attempted item and I’ve tried with various transformations and js.

Switch SengledA19_TOGGLE "SengledA19 [%s]"  <light> { mqtt=">[pibroker:zigbee/0xb0ce1814030ac279/set:command:*:JS(setZigbeeState.js)],<[pibroker:zigbee/0xb0ce1814030ac279:state:JSONPATH($.state)]"  }


I think so.



Yes. It’s now paired to zigbee2mqtt/CC2531, the pairing to Alexa is history.

A few hints:

  • You should check the log of zigbee2mqtt.
  • if you changed the friendly name, you need to use the new name as topic
  • switch the light on and off, does zigbee2mqtt receive that?

This is most likely something really trivial, doublecheck all your stuff.

The stick and Z2M need to be on the same machine and it needs to read the USB port directly. I don’t know if this is how you have it.

This problem can be ruled out, @H102 already stated that he was able to control the light with messages sent from windows. Just the correct messages from/to openHAB are missing

Actually he never said windows. And I’m still trying to get clarification from his post. He said.

“The usb stick has not been moved, it’s on an RPI, but not the same RPI I’m running OH on”

But where is Z2M installed on the OH Pi? Or on the Pi with the Zigbee stick? because this part
“I followed the same instructions for setting up the bridge. Are you using the USB stick on the same machine that’s running OH? I ask b/c I’m not sure what the yaml config should look like when the usb is on a separate machine or does it matter?”

Confused me.

Anyway the important parts of the Yaml file is obviously to make sure that you can connect to your MQTT broker.
And it sounds like he’s tested it.

So then the next part. @H102
Can you post your yaml file and your Item file. It’s just a matter of the topics not being set up correctly.
But that can be checked using an MQTT client.

You are right. But he said he sent messages to zigbee2mqtt from his “PC”. “PC” implicitly triggered Windows for me, which is not granted. But these messages worked as expected.

So, it is something concerning item definition (either topic or message construction).

Correct, I try to refrain from using such foul words.:grin: The PC (personal computer) used is linux mint.

The Zigbee stick and bridge setup is installed on an RPI 2 B.
My OH is running on an RPI 3B+ and nothing else is connected to it’s USB (other than SSD hard drive).

Here’s the yaml file:
The user and password is the same here as I use when setting up an Esp8266 device. The server: mqtt:// is the local address of the RPI 2 B. Similar to setting up an Esp I tried to enter the address of my OH broker, but that caused the zigbee2mqtt to fail, so I changed it back to the RPI 2 B local address.

I only have one item for the zigbee it’s in post #3 and here is the mqtt message used to turn on the light.


Just a few questions in no particular order:

  • Is there anything suspicious reported in openHAB’s log?

  • When you publish from openHAB to the ZigBee topic (using the Switch item), do you see the topic’s value change in MQTT-Spy? If you don’t then openHAB isn’t communicating with the MQTT Broker.

  • I assume “pibroker” is correctly defined in openHAB’s “mqtt.cfg” file and points to “” using the correct credentials? If this isn’t working then openHAB will fail to communicate with the MQTT Broker (obviously).

1 Like

Thanks @123 I think you found the problem.

pibroker in OH’s mqtt.cfg file is pointing to the broker (address that I install via openhabian during initial setup.

Looks like the zigbee2mqtt install on the RPI2 created another mosquito broker. I thought about this when testing but changing the yaml file to point toward caused the zigbee2mqtt to stop working. Any hints on what zigbee2mqtt file to changed or removed so it connects with the same broker that OH is using?

Thanks to all.

Just for the sake of double checking, something I should have done before posting, I changed the yaml file again. After restarting zigbee2mqtt and watching the log I’m connected with the same broker as OH.:smiley:

Maybe the first attempt had a typo? I’ll need to factory reset the bulb again, connect it to my zigbee stick and see what happens, but I think the issues is solved.

Thanks to all for the help and support.

Oops! Looks like you may have solved the problem whiIe I was composing my response! Anyway, I’ll leave my post here in case it helps others.

Original post:

I’ve never used zigbee2mqtt (but I’ve read about it).

Your configuration.yaml file appears to be correctly configured. I would suggest you enable debug mode, restart zigbee2mqtt, then check its log file. It might reveal why zigbee2mqtt “stops working” when it attempts to connect to your MQTT Broker at

Hopefully the log will provide more clues. It might just be a problem with authentication (it fails to login to the MQTT Broker).

1 Like

Just to follow up, after changing the yaml file, a restart and resetting the bulb everything has been working smooth.:sunglasses:

Hey there

i hope its ok to use this thread.

welcome to everyone. Im Eric and i want to build openhabian on a Pi 3B. Thanks to the documentation i have come far, including MQTT Broker and so on.

Now i try to install zigbee2mqtt.

i followed the official documentation (https://koenkk.github.io/zigbee2mqtt/getting_started/running_zigbee2mqtt.html)

node version is 10.15.1
npm version is 6.4.1

when doing the step “# Clone zigbee2mqtt repository” i didnt suceed.

i did “sudo git clone https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt” which should be okay.
then i did “sudo chown -R openhabian:openhabian /opt/zigbee2mqtt” and after that tried to install dependencies but that was stopped by a error message.

output is:

  • > serialport@6.2.2 install /opt/zigbee2mqtt/node_modules/serialport

  • > prebuild-install || node-gyp rebuild

  • prebuild-install WARN install No prebuilt binaries found (target=10.15.1 runtime=node arch=arm platform=linux)

  • gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR

  • gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR

  • _gyp ERR! configure error _

  • gyp ERR! stack Error: EACCES: permission denied, mkdir ‘/opt/zigbee2mqtt/node_modules/serialport/build’

  • gyp ERR! System Linux 4.14.79-v7+

  • gyp ERR! command “/home/openhabian/.nvm/versions/node/v10.15.1/bin/node” “/home/openhabian/.nvm/versions/node/v10.15.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild”

  • gyp ERR! cwd /opt/zigbee2mqtt/node_modules/serialport

  • gyp ERR! node -v v10.15.1

  • gyp ERR! node-gyp -v v3.8.0

  • _gyp ERR! not ok _

  • npm ERR! code ELIFECYCLE

  • npm ERR! errno 1

  • npm ERR! serialport@6.2.2 install: prebuild-install || node-gyp rebuild

  • npm ERR! Exit status 1

  • _npm ERR! _

  • npm ERR! Failed at the serialport@6.2.2 install script.

  • npm ERR! This is probably not a problem with npm. There is likely additional logging output above

Do you know what happened? Do you need the whole log?

Thanks a lot in advance