Zwave-JS Server without docker for ARM platforms

These instructions assume that you know how to install and navigate your OS on your device.

Install Raspberry Raspbian for the raspberry pi ARM Platform depending on your hardware.

Initial setup of Raspberry Raspbian is easier with monitor keyboard and mouse hooked up local to your device.
Enable SSH in configuration, once you have enabled SSH then remote configuring is preferred for below instructions.
You can copy and paste below commands into the terminal, these instructions assume you have knowledge on the ability to SSH into your device.
Copy and paste is the easiest, and PuTTY allows right click paste.
These steps use the default user of pi, so if using different then what is default make changes as needed.

(Note some stuff will not work fully until all the steps have been done IE shared folders won’t connect until that directory is made.)

This instruction will do the following:

  1. Will allow network shares of certain folders for editing and backing up your configuration of files and access to root directory.
    ((WARNING MESSING AROUND IN ROOT DIR CAN BREAK YOUR INSTALL))

  2. Will install Zwave-JS2MQTT server onto your device.

  3. Will allow Zwave-JS Server to restart after a reboot.

  4. Will allow Access at your machines IP local address “http://xxx.xxx.xxx.xxx:8091/

"DO NOT COPY AND PASTE STUFF IN QUOTES"

“LOG INTO THE TERMINAL.”

sudo apt update

sudo apt upgrade -y

sudo apt autoremove -y

“STEPS BELOW ALLOWS SHARING OF FOLDERS OVER YOUR LOCAL NETWORK.”


sudo apt install samba -y


sudo nano /etc/samba/smb.conf

“CLEAR SCREEN BY HOLDING DOWN THE CTRL AND K KEYS.”

“COPY ALL BELOW THIS LINE DOWN TO NOT INCLUDING END.”


[global]
netbios name = Zwave Server
server string = The HA File Center
workgroup = WORKGROUP
hosts allow =
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536
remote announce =
remote browse sync =

[HOME PI]
path = /home/pi
comment = No comment
browsable = yes
read only = no
valid users =
writable = yes
guest ok = yes
public = yes
create mask = 0777
directory mask = 0777
force user = root
force create mode = 0777
force directory mode = 0777
hosts allow =

[ROOT]
path = /
comment = No comment
browsable = yes
read only = no
valid users =
writable = yes
guest ok = yes
public = yes
create mask = 0777
directory mask = 0777
force user = root
force create mode = 0777
force directory mode = 0777
hosts allow =

[ZWAVE SERVER]
path = /home/pi/zwavejs2mqtt
comment = No comment
browsable = yes
read only = no
valid users =
writable = yes
guest ok = yes
public = yes
create mask = 0777
directory mask = 0777
force user = root
force create mode = 0777
force directory mode = 0777
hosts allow =

“END”

“PRESS CRTL+O (write out), ENTER, CTRL+X (exit).”

sudo smbpasswd -a pi

“ENTER THE PASSWORD IT WILL ASK TWICE.”

sudo service smbd restart

“STEPS BELOW MAKES Zwave-JS Server START ON REBOOT.”

sudo nano -w /etc/systemd/system/zwavejs.service

“COPY ALL BELOW THIS LINE DOWN TO NOT INCLUDING END.”

[Unit]
Description=ZWave-JS
Wants=network-online.target
After=network-online.target

[Service]
User=pi
Group=pi
WorkingDirectory=/home/pi/zwavejs2mqtt/
ExecStart=npm start

[Install]
WantedBy=multi-user.target

“END”

“PRESS CRTL+O (write out), ENTER, CTRL+X (exit).”

sudo systemctl --system daemon-reload

sudo systemctl enable zwavejs.service

sudo systemctl disable hciuart

“PREREQUISITES”

curl -sL https://deb.nodesource.com/setup_16.x | sudo bash -

sudo apt-get install -y nodejs

“BELOW DISABLES BLUETOOTH ON THE PI SEEMS TO SOLVE SOME ISSUES”

dtoverlay=disable-bt

sudo systemctl disable hciuart

"BELOW INSTALLS THE ZWAVE JS SERVER."

“Reboots when done with install.”

cd

mkdir zwavejs2mqtt

git clone https://github.com/zwave-js/zwavejs2mqtt

cd zwavejs2mqtt

npm install

npm run build ; sudo reboot

“BELOW STARTS THE SERVER”

If you installed everything and rebooted and try to use below it will whine about the port in use because it is already started.

cd

cd zwavejs2mqtt

npm start

"UPGRADING THIS INSTALL"

“This reboots the server so it can run as a service vs doing a npm start that shuts down when you exit the terminal”

“NOTE: If it does not reboot then it did not update ZwaveJS portion just rerun the upgrade to complete the upgrade sequence.”

cd

sudo apt update

sudo apt upgrade -y

sudo apt autoremove -y

killall node

cd zwavejs2mqtt

git reset --hard
git pull

npm update

npm audit fix --force

sudo reboot


"WARNING BELOW DELETES THE DIR AND ALL THAT IS IN IT,"
"BACK UP YOUR FILES"

" Only use this if you want to do a clean reinstall of the Zwave Server"

sudo rm -r zwavejs2mqtt

"UPGRADING THIS INSTALL HARSH"

“This copies your user files to the pi document folder deletes the zwavejs2mqtt folder and does a full blown reinstall and then copies your user files back and starts interviews from scratch after the reboot.”

“This reboots the server so it can run as a service vs doing a npm start that shuts down when you exit the terminal.”

“NOTE: If it does not reboot then it did not update ZwaveJS portion just rerun the upgrade to complete the upgrade sequence.”

cd

sudo apt update

sudo apt upgrade -y

sudo apt autoremove -y

killall node

mkdir /home/pi/Documents/store/

sudo cp -r /home/pi/zwavejs2mqtt/store/nodes.json /home/pi/Documents/store

sudo cp -r /home/pi/zwavejs2mqtt/store/settings.json /home/pi/Documents/store

sudo cp -r /home/pi/zwavejs2mqtt/store/users.json /home/pi/Documents/store

sudo rm -r zwavejs2mqtt

cd

mkdir zwavejs2mqtt

git clone https://github.com/zwave-js/zwavejs2mqtt

sudo cp -r /home/pi/Documents/store/ /home/pi/zwavejs2mqtt/

sudo chmod -R ugo+rw /home/pi/zwavejs2mqtt/

cd zwavejs2mqtt

npm install

npm run build ; sudo reboot

"REVERTING BACK TO A PREVIOUS VERSION"

“This allows you to go back to a previous version incase the latest update breaks your system
not guaranteed to fix your broken setup but is a option to try”

"Type in your Version Number

version=
cd

sudo apt update

sudo apt upgrade -y

sudo apt autoremove -y

killall node

mkdir /home/pi/Documents/store/

sudo cp -r /home/pi/zwavejs2mqtt/store/nodes.json /home/pi/Documents/store

sudo cp -r /home/pi/zwavejs2mqtt/store/settings.json /home/pi/Documents/store

sudo cp -r /home/pi/zwavejs2mqtt/store/users.json /home/pi/Documents/store

sudo rm -r zwavejs2mqtt

cd

mkdir zwavejs2mqtt

git clone https://github.com/zwave-js/zwavejs2mqtt/archive/refs/tags/$version.zip
sudo cp -r /home/pi/Documents/store/ /home/pi/zwavejs2mqtt/

sudo chmod -R ugo+rw /home/pi/zwavejs2mqtt/

cd zwavejs2mqtt

npm install

npm run build ; sudo reboot

3 Likes

Thanks for the wonderful guide!

It will be even better if you could point how to keep the installation updated after the initial setup.

I primarily run on a 386-64 setup and I have that tutorial to where it updates the install I will see what is involved to get the arm version to update the install as well

1 Like

found a way to update the install make sure you back up your configurations and settings before doing it as it is just good practice

In the meantime I’ve tried with the following steps, and got success:

  • stop service
  • git pull
  • npm update
  • start service

Got everything updated and up&running, without loosing any configuration. Try this way yourself and let me know if you got success.

vague commands is what frustrates people

nope did not work

no such thing as a stop command

finally figured out how to upgrade this

step by step instruction that can be copy and paste

2 Likes

Agreed. It’s so unbelievably annoying with the push towards so many doing docker only instructions.

Don’t know why these simple standalone instructions get overlooked with devs. Docket containers are a pain in the ass to tinker with or upgrade in place.

Thank you!

@trentjw

Here’s the results on my Pi Zero W using 2021-05-07-raspios-buster-armhf.img and adjusting to “v10”

[email protected]:~ $ curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -

================================================================================
================================================================================

                              DEPRECATION WARNING                            

  Node.js 10.x is no longer actively supported!

  You will not receive security or critical stability updates for this version.

  You should migrate to a supported version of Node.js as soon as possible.
  Use the installation script that corresponds to the version of Node.js you
  wish to install. e.g.

   * https://deb.nodesource.com/setup_12.x — Node.js 12 LTS "Erbium"
   * https://deb.nodesource.com/setup_14.x — Node.js 14 LTS "Fermium" (recommended)
   * https://deb.nodesource.com/setup_16.x — Node.js 16 "Gallium"

  Please see https://github.com/nodejs/Release for details about which
  version may be appropriate for you.

  The NodeSource Node.js distributions repository contains
  information both about supported versions of Node.js and supported Linux
  distributions. To learn more about usage, see the repository:
    https://github.com/nodesource/distributions

================================================================================
================================================================================

Continuing in 20 seconds ...


## Installing the NodeSource Node.js 10.x repo...


## You appear to be running on ARMv6 hardware. Unfortunately this is not currently supported by the NodeSource Linux distributions. Please use the 'linux-armv6l' binary tarballs available directly from nodejs.org for Node.js 4 and later.

[email protected]:~ $

I wonder, should I pivot to this to get NPM:

try what they recommend

Moving again…

Swapped out:
curl -sL https://deb.nodesource.com/setup_16.x | sudo bash -

with:
https://danidudas.medium.com/how-to-install-node-js-and-npm-on-raspberry-pi-zero-or-other-arm-v6-device-220d0392a426

As I got to the npm install, the results are below, at which point it hung for over 30min:

[email protected]:~/zwavejs2mqtt $ npm install
npm WARN deprecated [email protected]: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
npm WARN deprecated @babel/[email protected]: 🚨 This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
npm WARN deprecated [email protected]: This loader has been deprecated. Please use eslint-webpack-plugin
npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated [email protected]: [email protected]<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated [email protected]: The
npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: The
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated re[email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated

> @serialport/[email protected] install /home/pi/zwavejs2mqtt/node_modules/@serialport/bindings
> prebuild-install --tag-prefix @serialport/[email protected] || node-gyp rebuild

prebuild-install WARN install socket hang up

process would be slower on the zero

I reconnected ssh, and re-ran it with the zwave plugged in this time:


[email protected]:~/zwavejs2mqtt $ npm install
npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected]~2.3.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected]^1.2.7 (node_modules/webpack-dev-server/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})

audited 2008 packages in 486.479s

184 packages are looking for funding
  run `npm fund` for details

found 8 vulnerabilities (4 moderate, 4 high)
  run `npm audit fix` to fix them, or `npm audit` for details
[email protected]:~/zwavejs2mqtt $

on your computer type the ip address of your zero in your browser with this on the end of it :8091

not there yet, here’s the npn run build:

[email protected]:~/zwavejs2mqtt $ npm run build

> [email protected] build /home/pi/zwavejs2mqtt
> npm-run-all build:*


> [email protected] build:server /home/pi/zwavejs2mqtt
> tsc


> [email protected] build:ui /home/pi/zwavejs2mqtt
> node build/build.js


To use this template, you must update following to modules:

  node: 10.24.1 should be >= 12.0.0

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:ui: `node build/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build:ui script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2021-07-06T02_41_04_309Z-debug.log
ERROR: "build:ui" exited with 1.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `npm-run-all build:*`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2021-07-06T02_41_04_678Z-debug.log
[email protected]:~/zwavejs2mqtt $
[email protected]:~/zwavejs2mqtt $ cat /home/pi/.npm/_logs/2021-07-06T02_41_04_678Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 info lifecycle [email protected]~build: [email protected]
7 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~build: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/pi/zwavejs2mqtt/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
9 verbose lifecycle [email protected]~build: CWD: /home/pi/zwavejs2mqtt
10 silly lifecycle [email protected]~build: Args: [ '-c', 'npm-run-all build:*' ]
11 silly lifecycle [email protected]~build: Returned: code: 1  signal: null
12 info lifecycle [email protected]~build: Failed to exec build script
13 verbose stack Error: [email protected] build: `npm-run-all build:*`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:198:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:198:13)
13 verbose stack     at maybeClose (internal/child_process.js:982:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/pi/zwavejs2mqtt
16 verbose Linux 5.10.17+
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
18 verbose node v10.24.1
19 verbose npm  v6.14.12
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] build: `npm-run-all build:*`
22 error Exit status 1
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

quite possible the npm is just not new enough to handle it as it it had errors of stuff not supported on your device quite possible the zero just not enough

I’m trying to use this on a setup where I have a Tellstick running. The problem is that the command sudo apt-get install -y nodejs removes two packages that the Tellstick needs. Is there a way to upgrade nodejs to a version that wortks with zwjs2mqtt without removing stuff?

You could try something like asdf to install versions of node that aren’t tied to the OS package manager.

Thank you, I’ll try that! I trided npm, and that didn’t get me far.