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