# Zigbee2mqtt restarts continuously

**URL:** <https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164>\
**Category:** General\
**Created:** [25 December 2024 20:32 UTC](https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164 "2024-12-25T20:32:12Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![devifast](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@devifast](https://discourse.nodered.org/u/devifast)\
**Post date:** [25 December 2024 20:32 UTC](https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164/1 "2024-12-25T20:32:12Z")

</div>

I have Dietpi installed and I am trying to run zigbee2mqtt on Node red. The process is going smoothly until I get this on the system console. I get this.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/e/6ef59b414c541e7c7117e5205a2704a92099e439.png)  
This is a process that repeats itself constantly.  
The installation is done this way with minor changes.[https://www.zigbee2mqtt.io/guide/installation/01\_linux.html](https://www.zigbee2mqtt.io/guide/installation/01_linux.html)  
If I give a command:cd /opt/zigbee2mqtt  
npm start  
In Node red everything works. If I set it as a service, I start getting the above messages.  
In a baskground  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/c/9c7d268aad489b70518095bc8d8c7f564b5dafbf.png)  
service is working.

Any ideas? Thanks.

---

<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:** [25 December 2024 21:00 UTC](https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164/2 "2024-12-25T21:00:01Z")

</div>

What node is showing those messages?

---

<div class="post-metadata">

**Author:** ![devifast](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@devifast](https://discourse.nodered.org/u/devifast)\
**Post date:** [25 December 2024 21:02 UTC](https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164/3 "2024-12-25T21:02:19Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/6/262629486222765621f633fa602fadcc7ac96964.png)  
zigbee2mqtt  
[https://flows.nodered.org/node/node-red-contrib-zigbee2mqtt](https://flows.nodered.org/node/node-red-contrib-zigbee2mqtt)

---

<div class="post-metadata">

**Author:** ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)\
**Post date:** [25 December 2024 22:01 UTC](https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164/4 "2024-12-25T22:01:56Z")

</div>

I would suggest try using plain 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:** [25 December 2024 22:33 UTC](https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164/5 "2024-12-25T22:33:03Z")

</div>

I agree with @Buckskin, just use MQTT In and Out to communicate with zigbee2mqtt. To see all the topics published then install MQTTExplorer on your PC and you will be able to see everything.

---

<div class="post-metadata">

**Author:** ![devifast](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@devifast](https://discourse.nodered.org/u/devifast)\
**Post date:** [25 December 2024 22:37 UTC](https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164/6 "2024-12-25T22:37:04Z")

</div>

This is some kind of joke, right?  
Describe the sensor here.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/0/20f936a4f24cbbf324829651e93f684341b8f779.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/4/24bdf9ea88bb37f960a0feb6f1efc034840ee8dd.png)  
Or it's more clearly visible on the second slide.

---

<div class="post-metadata">

**Author:** ![devifast](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@devifast](https://discourse.nodered.org/u/devifast)\
**Post date:** [25 December 2024 22:53 UTC](https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164/7 "2024-12-25T22:53:31Z")

</div>

If so, give an example flow

---

<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:** [25 December 2024 23:25 UTC](https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164/8 "2024-12-25T23:25:14Z")

</div>

using an mqtt node, subscribe to the topic:

```auto
zigbee2mqtt/knob/#
or
zigbee2mqtt/bridge/#

```

mqtt nodes are more flexible as you won't be depending on device support.

---

<div class="post-metadata">

**Author:** ![devifast](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@devifast](https://discourse.nodered.org/u/devifast)\
**Post date:** [26 December 2024 03:18 UTC](https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164/9 "2024-12-26T03:18:16Z")

</div>

What happens if I press a button and the connection is interrupted?

---

<div class="post-metadata">

**Author:** ![devifast](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@devifast](https://discourse.nodered.org/u/devifast)\
**Post date:** [26 December 2024 03:20 UTC](https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164/10 "2024-12-26T03:20:16Z")

</div>

I can tell you from personal experience: NOTHING.  
That's why I'm bringing this up. Best regards.

---

<div class="post-metadata">

**Author:** ![devifast](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@devifast](https://discourse.nodered.org/u/devifast)\
**Post date:** [26 December 2024 03:27 UTC](https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164/11 "2024-12-26T03:27:12Z")

</div>

The problem is not in manipulating the commands, but in making them work correctly. Otherwise, in non-existence. (the trash can).

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/3/738ef432616e2efffb2251215baefef45b83cbf1.png)

---

<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:** [26 December 2024 05:38 UTC](https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164/12 "2024-12-26T05:38:02Z")

</div>

Your picture shows that the mqtt node topic was set to ‘test’, so yes, of course NOTHING.

---

<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:** [26 December 2024 09:55 UTC](https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164/13 "2024-12-26T09:55:09Z")

</div>

I think maybe you are not very familiar with mqtt. To learn more see this tutorial [MQTT Essentials - All Core Concepts Explained](https://www.hivemq.com/mqtt-essentials/)

---

<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:** [26 December 2024 12:10 UTC](https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164/14 "2024-12-26T12:10:53Z")

</div>

In particular, zigbee2MQTT provides an interface between a zigbee network and MQTT. It collects data from the zigbee devices and publishes it to MQTT. Clients (eg node-red) can subscribe to those topics via MQTT In nodes to receive that data, so node red can see the state of the devices. In addition clients can publish to zigbee device topics and zigbee2mqtt will receive that and pass it on to the devices, allowing node-red to control lights, for example.

If you look in the zigbee2MQTT web interface you can see the MQTT topics that the data are published to.

---

<div class="post-metadata">

**Author:** ![devifast](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@devifast](https://discourse.nodered.org/u/devifast)\
**Post date:** [27 December 2024 07:28 UTC](https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164/15 "2024-12-27T07:28:09Z")

</div>

I have been using Mosquitto broker for quite a long time on various platforms like Arduino,ESP32/8266 connected to Node red for process automation. I haven't had any problems so far. I am familiar with how the protocol works.  
The problem is not whether Zigbee2mqtt works but why it restarts every two minutes. When I start it in the console with the command cd /opt/zigbee2mqtt  
npm start works perfectly without restarting, all sensors send data to Node red without a problem. When I make Zigbee2mqtt as a service to start automatically when Dietpi starts, then the problems start. The Mosquitto broker is constantly online, Zigbee2mqtt restarts itself at almost equal intervals of time.  
Here is the Zigbee2mqtt configuration file with which it starts as a service.

```auto

[Unit]
Description=zigbee2mqtt
After=network.target

[Service]
Environment=NODE_ENV=production
Type=notify
#ExecStart=/usr/bin/node index.js
ExecStart=/usr/local/bin/node index.js
WorkingDirectory=/opt/zigbee2mqtt
#StandardOutput=null
# Or use StandardOutput=null if you don't want Zigbee2MQTT messages filling sys>
StandardError=inherit
WatchdogSec=10s
Restart=always
RestartSec=10s
User=root

[Install]
WantedBy=multi-user.target

```

I want to emphasize that everything goes without any problems during the installation, when I start it manually there are no problems, all Zigbee devices connect without a problem, during the tests I use two different Zigbee USB sticks, everything is ok.

---

<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:** [27 December 2024 07:47 UTC](https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164/16 "2024-12-27T07:47:50Z")

</div>

> [@devifast](#):
>
> I have been using Mosquitto broker for quite a long time on various platforms

Then why do think it is a joke to suggest the use of mqtt nodes to interact with zigbee2mqtt?

---

<div class="post-metadata">

**Author:** ![devifast](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@devifast](https://discourse.nodered.org/u/devifast)\
**Post date:** [27 December 2024 08:12 UTC](https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164/18 "2024-12-27T08:12:16Z")

</div>

The problem does not lie in this. I am looking for the reason why the process restarts, not how it communicates with other nodes. Apparently we could not understand each other. As I wrote above, under certain circumstances everything works perfectly. Let me emphasize that as a service, everything still works, but imagine if you have a button and you press it at the moment the process restarts, you will not get the result you expect (for example, turn on a lamp). If my wife starts pressing such a button and the on and off packets arrive with a delay, can you imagine what a festive show will begin. Greetings.

---

<div class="post-metadata">

**Author:** ![devifast](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@devifast](https://discourse.nodered.org/u/devifast)\
**Post date:** [27 December 2024 08:54 UTC](https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164/19 "2024-12-27T08:54:49Z")

</div>

I found the right place for this topic.  
It just doesn't belong here.  
[https://github.com/Koenkk/zigbee2mqtt/issues/21463](https://github.com/Koenkk/zigbee2mqtt/issues/21463)

---

<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:** [27 December 2024 09:00 UTC](https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164/20 "2024-12-27T09:00:23Z")

</div>

To save us slogging through that, did you find a solution?

---

<div class="post-metadata">

**Author:** ![devifast](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@devifast](https://discourse.nodered.org/u/devifast)\
**Post date:** [27 December 2024 09:35 UTC](https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164/21 "2024-12-27T09:35:54Z")

</div>

The problem is not in the Node red or Zigbee2mqtt node but somewhere in the settings. That's why I raised the topic in this forum, if anyone has encountered this problem, please share. Apparently I'm the first. When I have a result, I'll write. Thanks to everyone who responds.

[Next page](https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164.md?page=2)
