Add Zigbee2Mqtt device

I am running OpenHAB on a Raspberry Pi.

My current contact sensors use zigbee and use an USB drive I have to talk to openhab. I bought a new sensor that uses Zigbee2Mqtt from Aqara, I’ve successfully added it as a new zigbee thing but I can’t figure out the mqtt part. The contact switch only shows as a on/off switch in the paperUI.

I tried following tutorials and went to my “nano /opt/zigbee2mqtt/data/configuration.yaml” file but the file was empty. How can I finish the Mqtt part of the setup?

That is useful but how do I find my own state topics, such as “stateTopic = “zigbee2mqtt/LEAK/water_leak””

One way is to find your device in the zigbee2mqtt devices list webpage, and click on the configuration page. What device have you got?

Aqara Door and Window Sensor
Model: MCCGQ11LM

So this:

You therefore have:

  • zigbee2mqtt/<FRIENDLY_NAME>/battery
  • zigbee2mqtt/<FRIENDLY_NAME>/contact
  • zigbee2mqtt/<FRIENDLY_NAME>/linkquality

I use as a tool to see what is happening on the MQTT broker.

Where do I find out my “friendly_name” for the sensor?

From your configuration.yaml file, which you say is empty. You’ll have to find out why that’s empty first. Permissions issue? Are you sure zigbee2mqtt is properly installed and running?

Once you have access, you need to add a friendly_name parameter for your device.

I installed both the binding and the one in the misc tab. What can I do to figure out the issue from here?

Wait a minute: from where? zigbee2mqtt is a 3rd party program: nothing to do with openHAB…

The Mqtt binding and the MQTT Broker Moquette. I also need to install Mqtt on the pi itself?

I think you’re getting confused. Do you want to use the native openHAB Zigbee binding, or do you want to use the 3rd party zigbee2mqtt, and then the native openHAB MQTT binding?

Do you have zigbee2mqtt installed? You need to have zigbee2mqtt installed if you want to use zigbee2mqtt…

Also, remove the Moquette broker and install the 3rd party Mosquitto MQTT broker instead: Moquette is no longer maintained.

Install as you broker on the PI (it is the one broker/server/data passer)

I assume you are running

Configure zigbee2mqtt to work correctly following the above guide

Install the MQTT Explorer linked in above post.

See if you can see messages from your sensor in the MQTT broker using MQTT Explorer as it will subscribe to all topics.

Then look at openhab as it is a MQTT client using the MQTT binding

Until you get the sensor working with MQTT Explorer stop looking at openHAB as it will not work and you are working blind.

By all means ask as many questions here as you need,

I am attempting to start zigbee2mqtt, but I keep getting the following error:

pi@raspberrypi:/opt/zigbee2mqtt $ npm start

> zigbee2mqtt@1.16.1 start /opt/zigbee2mqtt
> node index.js

Zigbee2MQTT:info  2020-11-23 17:19:39: Logging to console and directory: '/opt/zigbee2mqtt/data/log/2020-11-23.17-19-37' filename: log.txt
Zigbee2MQTT:info  2020-11-23 17:19:39: Starting Zigbee2MQTT version 1.16.1 (commit #4978d09)
Zigbee2MQTT:info  2020-11-23 17:19:39: Starting zigbee-herdsman...
Zigbee2MQTT:error 2020-11-23 17:20:01: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2020-11-23 17:20:01: Failed to start zigbee
Zigbee2MQTT:error 2020-11-23 17:20:01: Exiting...
Zigbee2MQTT:error 2020-11-23 17:20:01: Error: Failed to connect to the adapter (Error: SRSP - SYS - ping after 6000ms)
at ZStackAdapter.<anonymous> (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/adapter/z-stack/adapter/zStackAdapter.js:94:31)
at Generator.throw (<anonymous>)
at rejected (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/adapter/z-stack/adapter/zStackAdapter.js:25:65)
npm ERR! errno 1
npm ERR! zigbee2mqtt@1.16.1 start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the zigbee2mqtt@1.16.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2020-11-24T01_20_01_315Z-debug.log

I tried editing the config with and tried ttyUSB0 and ttyUSB1, but both still cause the error.

I’ve been doing research and I think my USB Stick isn’t compatible with Zigbee2Mqtt. I have a Nortek USB Stick.


If I buy a supported USB Stick how hard is it to transfer the ones on the old one to a new one?

You wouldn’t transfer - just unpair from the Nortek stick, and pair with the new stick.

But I would question why you would do that - you have a perfectly fine Zigbee controller with the Nortek: why not use the Zigbee binding?

If you go with zigbee2mqtt, you need to make sure you read ALL the documentation before you start: for example, you must be aware that you need to flash firmware into the new stick?

My issue is my Zigbee contact sensors die or become out or range and don’t notify me. I researched ones that will alert that and was told Mqtt communicates with them constantly and would alert me when they lose connection.

Is there a better way to do this?