





























I would highly recommend not to run the zwave server as root.
Add to the service file:
[Service]
User=zwave-js
SupplementaryGroups=uucp
Most likely the service will need uucp group if using a usb dongle
And then you can include two more files:
tmpfiles.d
d /run/zwave-js/ 0755 zwave-js zwave-js
d /var/lib/zwave-js 0755 zwave-js zwave-js
d /var/log/zwave-js 0755 zwave-js zwave-js
sysusers.d
u zwave-js - "zwave-js server user"
m zwave-js uucp
And then within the PKGBUILD package() function add:
install -Dm644 tmpfiles.d "${pkgdir}"/usr/lib/tmpfiles.d/zwave-js.conf
install -Dm644 sysusers.d "${pkgdir}"/usr/lib/sysusers.d/zwave-js.conf
Thanks for the package and example btw
I'm really glad you liked the suggestions! <3 I upgraded the package, removed my local changes, and everything fired up perfectly. Thank you!
Thanks for the suggestions synthead. They all seemed like good ones, so I've modified the package pretty much exactly as you suggested.
For anyone else, 1.40.0-2 is a breaking change. The systemd template is now instanced using a config file name rather than a device path. The config file should be in /etc/conf.d/zwave-js-server/. If your config file is nortek.conf, then do:
systemctl enable zwave-js-server@nortek systemctl start zwave-js-server@nortek
Of course, stop and disable your existing service first. There's an example config file in /etc/conf.d/zwave-js-server.
The zwave-js-server library has support for binding to an IP, choosing a port, setting up encryption keys, logging directories, etc. See https://github.com/zwave-js/zwave-js-server/issues/1345.
To support configuring these settings, I recommend including a /etc/conf.d/zwave-js-server/ directory with .conf files respective to the zwave-js-server deployment.
For example, this is what I have in /etc/conf.d/zwave-js-server/nortek.conf:
ZWAVE_JS_SERVER_ARGS="/dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Controller_C0F00A04-if00-port0 --host=zwave --port=3000 --config=/etc/zwave-js-server/nortek.js"
I also added /etc/zwave-js-server/nortek.js, with the contents being:
module.exports = {
securityKeys: {
S0_Legacy: Buffer.from("<censored>", "hex"),
S2_AccessControl: Buffer.from("<censored>", "hex"),
S2_Authenticated: Buffer.from("<censored>", "hex"),
S2_Unauthenticated: Buffer.from("<censored>", "hex")
}
};
To make this all work, I added my own /etc/systemd/system/zwave-js-server@.service (to override /usr/lib/systemd/system/zwave-js-server@.service from this package) with these contents:
[Unit]
Description=ZWave-JS Server Daemon "%i" instance
Before=home-assistant.service
[Service]
EnvironmentFile=/etc/conf.d/zwave-js-server/%I.conf
ExecStart=/usr/bin/zwave-server $ZWAVE_JS_SERVER_ARGS
[Install]
WantedBy=multi-user.target
It'd be great to have this included in this package :) As the above is written, it'd be a breaking change, so heads up.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。
In addition to @skunark's suggestions, please also have zwave-js-server restart on failure. Add this:
While the service should never crash (and never have bugs!), if it does, Z-Wave integration breaks until someone restarts the service. In my case, I have some sketch Z-Wave nodes that zwave-js-server occasionally has a hard time reaching, and the server has proven to be pretty fragile in these cases. Exceptions are raised, and the service terminates.