Zigbee2mqtt restarts continuously

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.


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
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

service is working.

Any ideas? Thanks.

What node is showing those messages?


zigbee2mqtt
https://flows.nodered.org/node/node-red-contrib-zigbee2mqtt

I would suggest try using plain MQTT nodes.

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.

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



Or it's more clearly visible on the second slide.

If so, give an example flow

using an mqtt node, subscribe to the topic:

zigbee2mqtt/knob/#
or
zigbee2mqtt/bridge/#

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

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

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

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

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

I think maybe you are not very familiar with mqtt. To learn more see this tutorial MQTT Essentials - All Core Concepts Explained

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.

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.


[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.

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

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.

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

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

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.