After setting up zigbe2mqtt IN node, the Node-RED immediately disconnects and crashes

Hi, I'm a complete newbie, so please be patient, simple and explaining with your answers.
I have
RaspberryPi 2B, latest Raspbian image, Zigbee2MQTT with mosquito broker.
No security except usernames and passwords
Node-RED version: v3.0.2
Node.js version: v16.19.1
Linux 5.15.84-v7+ arm LE

I'm able to install and run Node-Red, access its web interface, download additional palletes such as node-red-contrib-zigbee2mqtt

But once I drag the "zigbee2mqtt in" node to the flow, doubleclick to configure it, enter the MQTT server address, then the node-RED crashes and keeps restarting its service. I have tried to completely remove and reinstall the node-RED packages

  1. sudo npm -g remove node-red
  2. sudo npm -g remove node-red-admin
  3. rm -R ~/.node-red


bash <(curl -sL

but when I start to configure the node, it fails again.

It is failing with these messages in the log:

21 Feb 20:47:43 - [info]
Welcome to Node-RED
21 Feb 20:47:43 - [info] Node-RED version: v3.0.2
21 Feb 20:47:43 - [info] Node.js  version: v16.19.1
21 Feb 20:47:43 - [info] Linux 5.15.84-v7+ arm LE
21 Feb 20:47:48 - [info] Loading palette nodes
21 Feb 20:47:55 - [info] Settings file  : /home/pi/.node-red/settings.js
21 Feb 20:47:55 - [info] Context store  : 'default' [module=memory]
21 Feb 20:47:55 - [info] User directory : /home/pi/.node-red
21 Feb 20:47:55 - [info] Projects directory: /home/pi/.node-red/projects
21 Feb 20:47:56 - [info] Server now running at
21 Feb 20:47:56 - [info] Active project : HomeAutomation
21 Feb 20:47:56 - [info] Flows file     : /home/pi/.node-red/projects/HomeAutomation/first-flow.json
21 Feb 20:47:56 - [info] Starting flows
21 Feb 20:47:56 - [info] Started flows
21 Feb 20:47:56 - [info] [zigbee2mqtt-server:MQTTserver] MQTT Connected
21 Feb 20:47:56 - [info] [zigbee2mqtt-server:MQTTserver] MQTT Subscribed to: "zigbee2mqtt/#
21 Feb 20:47:56 - [red] Uncaught Exception:
**21 Feb 20:47:56 - [error] TypeError: Cannot use 'in' operator to search for 'brightness' in on**
**    at Function.payload2homekit (/home/pi/.node-red/node_modules/node-red-contrib-zigbee2mqtt/resources/Zigbee2mqttHelper.js:201:26)**
    at ServerNode._getItemByKey (/home/pi/.node-red/node_modules/node-red-contrib-zigbee2mqtt/nodes/server.js:133:63)
    at ServerNode.getDeviceByKey (/home/pi/.node-red/node_modules/node-red-contrib-zigbee2mqtt/nodes/server.js:156:25)
    at ServerNode.getDeviceOrGroupByKey (/home/pi/.node-red/node_modules/node-red-contrib-zigbee2mqtt/nodes/server.js:143:31)
    at ServerNode.onMQTTMessage (/home/pi/.node-red/node_modules/node-red-contrib-zigbee2mqtt/nodes/server.js:831:32)
    at MqttClient.<anonymous> (/home/pi/.node-red/node_modules/node-red-contrib-zigbee2mqtt/nodes/server.js:27:62)
    at MqttClient.emit (node:events:513:28)
    at MqttClient._handlePublish (/home/pi/.node-red/node_modules/mqtt/lib/client.js:1547:12)
    at MqttClient._handlePacket (/home/pi/.node-red/node_modules/mqtt/lib/client.js:535:12)
    at work (/home/pi/.node-red/node_modules/mqtt/lib/client.js:438:12)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.
nodered.service: Consumed 21.126s CPU time.
nodered.service: Scheduled restart job, restart counter is at 12.
Stopped Node-RED graphical event wiring tool.
nodered.service: Consumed 21.126s CPU time.
Started Node-RED graphical event wiring tool.
21 Feb 20:48:21 - [info]
Welcome to Node-RED

This keeps repeating on and on...

I have no other flows, no other nodes in the flow.
I tried to google, ChatGPT, looking through forums but I'm too lame to figure out what is wrong and how should I fix this :frowning:

Thank you for your help.

On commandline:


node-red --safe

Correct your flow and deploy.

Don't use the zigbee2mqtt node, as you have found, it has issues. Just use the core mqtt nodes.

I don't know WHAT to correct in my flow. The only node in the flow is the "zigbee2mqtt in" node and its only configuration is the server to which it should connect + the username and password it should use.
So what exactly should I correct on this please?

Yes, After several re-installs and hours of googling I might as well use the standard MQTT nodes....

The zigbee nodes do not offer much extra anyway.

True! Got my flow now with motion sensor, push button and a wall socket running just fine with the core MQTT nodes. Goodbye zigbee2mqtt nodes! :crazy_face:
Thanks for your time to respond. Appreciate it!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.