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

**URL:** https://discourse.nodered.org/t/after-setting-up-zigbe2mqtt-in-node-the-node-red-immediately-disconnects-and-crashes/75535
**Category:** General
**Tags:** zigbee, mqtt
**Created:** [21 February 2023 20:06 UTC](https://discourse.nodered.org/t/after-setting-up-zigbe2mqtt-in-node-the-node-red-immediately-disconnects-and-crashes/75535 "2023-02-21T20:06:04Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![SparrowCZ](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sparrowcz/32/76498_2.png) [@SparrowCZ](https://discourse.nodered.org/u/SparrowCZ)
#### Post date: [21 February 2023 20:06 UTC](https://discourse.nodered.org/t/after-setting-up-zigbe2mqtt-in-node-the-node-red-immediately-disconnects-and-crashes/75535/1 "2023-02-21T20:06:04Z")

</div>

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`

then

```auto
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

```

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

It is failing with these messages in the log:

```auto
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 http://192.168.0.105:1880/
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 ☹

Thank you for your help.

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [21 February 2023 20:43 UTC](https://discourse.nodered.org/t/after-setting-up-zigbe2mqtt-in-node-the-node-red-immediately-disconnects-and-crashes/75535/2 "2023-02-21T20:43:32Z")

</div>

On commandline:

`node-red-stop`

`node-red --safe`

Correct your flow and deploy.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [21 February 2023 20:49 UTC](https://discourse.nodered.org/t/after-setting-up-zigbe2mqtt-in-node-the-node-red-immediately-disconnects-and-crashes/75535/3 "2023-02-21T20:49:26Z")

</div>

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

---

<div class="post-metadata">

### Author: ![SparrowCZ](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sparrowcz/32/76498_2.png) [@SparrowCZ](https://discourse.nodered.org/u/SparrowCZ)
#### Post date: [21 February 2023 23:39 UTC](https://discourse.nodered.org/t/after-setting-up-zigbe2mqtt-in-node-the-node-red-immediately-disconnects-and-crashes/75535/5 "2023-02-21T23:39:26Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![SparrowCZ](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sparrowcz/32/76498_2.png) [@SparrowCZ](https://discourse.nodered.org/u/SparrowCZ)
#### Post date: [21 February 2023 23:41 UTC](https://discourse.nodered.org/t/after-setting-up-zigbe2mqtt-in-node-the-node-red-immediately-disconnects-and-crashes/75535/6 "2023-02-21T23:41:00Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [22 February 2023 09:03 UTC](https://discourse.nodered.org/t/after-setting-up-zigbe2mqtt-in-node-the-node-red-immediately-disconnects-and-crashes/75535/7 "2023-02-22T09:03:53Z")

</div>

The zigbee nodes do not offer much extra anyway.

---

<div class="post-metadata">

### Author: ![SparrowCZ](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sparrowcz/32/76498_2.png) [@SparrowCZ](https://discourse.nodered.org/u/SparrowCZ)
#### Post date: [22 February 2023 10:04 UTC](https://discourse.nodered.org/t/after-setting-up-zigbe2mqtt-in-node-the-node-red-immediately-disconnects-and-crashes/75535/8 "2023-02-22T10:04:47Z")

</div>

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! 🤪  
Thanks for your time to respond. Appreciate it!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [8 March 2023 10:05 UTC](https://discourse.nodered.org/t/after-setting-up-zigbe2mqtt-in-node-the-node-red-immediately-disconnects-and-crashes/75535/9 "2023-03-08T10:05:29Z")

</div>

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