-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[Feature request]: Improve zigbee2mqtt startup experience by a better use of systemd unit definition #20413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Looks good, please create a PR to update the docs. |
Thanks, I'll do for the |
Hey guys, is this guaranteed to work on all systems correctly? I can confirm latest master does not notify systemd for me and causes Zigbee2MQTT to be repeatedly restarted leading to delayed device response and high cpu usage spikes. I’ve lost countless hours trying to narrow down the reason for this over the past month.
I’m wondering if the default service configuration example in the docs should be the simpler exec type with notify as an advanced option? |
I’m on my cell phone right now. Please verify you have installed the “new additional” requirements at the op system level libsystemd-dev |
|
Good! Think this the other way around. The new starting method Activate your logs to see what might be happening and think that the new starting procedure is working for you |
BtW, I'm going to close this issue as it is already implemented |
Thank you for the reply. This is resolved for me as far as I’m concerned by using Type=exec and removing the watchdog timeout. This is just FYI for anyone who might later run into issues.
While I was annoyed at the lost time, I highly appreciate the work you have put into Zigbee2MQTT. I’ve been using it in combination with Node-RED for 4+ years for my home automation. The fact that I’ve freely enjoyed the fruits of your hard work is not lost to me. kind regards |
Is your feature request related to a problem? Please describe
Hi,
There are issues like #17032, #361, #17012 and #4829 to mention some that are related to the way the zigbbe2mqtt service unit is defined.
Current recommended unit definition is documented [here] (https://www.zigbee2mqtt.io/guide/installation/01_linux.html#optional-running-as-a-daemon-with-systemctl)
But there are multiple issues with this definition;
There is no
Type=
defined in the service. As stated in the documentation here the default value is set tosimple
and, as stated in the documentation "... this means systemctl start command lines for simple services will report success even if the service's binary cannot be invoked successfully".Describe the solution you'd like
The documentation for systemd units recommends to use either
exec
ornotify
Change to
exec
is straight forward. Just use this new unit definition:This solves some problems like missing the user or the executables defined in the unit. But it is still sub-optimal because the zigbee2mqtt service depends on the controller to be initialised properly. For example, if you are using a USB controller and you remove it from the computer the service will be considered started by the operating system but it is useless. So IMO the service should be called as
Type=notify
.Implementing
Type=notify
requires the code to notify the service daemon when it has succesfully started. Hopefully there is a library here that can be used for this purpose inside node.Describe alternatives you've considered
As indicated previously, I added
Type=exec
to the unit definitionAdditional context
I've not tested this but adding
sd-notify
as a dependency might fail on operating systems other than unix/linux?The text was updated successfully, but these errors were encountered: