Summary time - in other words, it’s working and I’d like to spell out everything in one place, so anyone searching for help on this will find it clearly written out.
First, do what @mobile.andrew.jones has said to install Docker - with one added command:
sudo apt-get remove docker docker-engine docker.io containerd runc
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker pi
exit
I’ve added the 2nd to last command line - I couldn’t run Docker as a normal user without it. And be sure to exit your shell. Then just log back in. Docker won’t work unless you do that.
Then, once Docker is installed, let’s deal with the Z-stick. I’ve had problems (and it’s a known issue) with USB Z-sticks and Raspberry Pis. So use a hub or a USB extension cable to keep the Z-stick 1’ or more away from your Pi. (I suspect this is also an issue with Insteon sticks - go for a bigger PLM on Insteon that can do dual mode, RF and through power lines. I wish I had not gone with a USB stick for Insteon!) Also, I’ve had problems with Z-Sticks in powered USB hubs. Unpowered hubs are fine, but I can’t get them to work with powered hubs.
Okay, Docker is in, the Z-Stick is hooked up, but not directly in the Pi. Next, let’s get the program itself, ZWaveJS2MQTT working. Again, thanks to @mobile.andrew.jones for most of this:
Enter the command ls -l /dev/serial/by-id/*
. Read the devices that show up in the output. It shouldn’t take much to figure out which one is the Z-Stick. (Mine is /dev/serial/by-id/usb-Silicon_Labs_CP2102N_USB_to_UART_Bridge_Controller_ac0656ead0e5ea11bfc18dd5994a5d01-if00-port0
). You’ll be copying and pasting that in a minute or two.
Here’s the two commands you need for setting this up, now that Docker is installed:
mkdir /home/pi/zwave
docker run -v /home/pi/zwave:/usr/src/app/store --device /dev/serial/by-id/your-stick-id:/dev/zwave -p 8091:8091 -p 3000:3000 --restart=always zwavejs/zwavejs2mqtt:latest
Note this includes --restart=always
. If you want this to act as a service or daemon, be sure that’s in there. Where it says your-stick-id
needs to be replaced with the id of your Z-stick device. Run this and it should work.
A note on command line options: If you use the Z2M wiki, which is quite useful, the command line it gives does NOT include the restart option, so if you use that, the program will die and won’t restart again unless you run it. If that’s your preference, that’s okay. But if you want it to restart each time you boot, like a Linux service, be sure the restart option is in there.
Once it’s started, you can point your browser at:
http://<hostaddress>:8091
Of course will have to be replaced by the IP address of your Pi or localhost if you’re working on your Pi.
That’ll bring up the web control panel. Here’s good starting settings:
General
Auth - turn on. Simple username (admin) and password (zwave) - it even tells you that. You don’t need this, but it protects it from being messed with by accident.
Log Level - depends on what you want. While I’m setting up, I set to Silly, then change to Debug. You can leave it as is.
Log Enabled - Turn on if you want logs. If you want help on this or any other forum, you’ll want logs because they give people info.
Log to File In this case, if you’ve followed the directions on this topic, turning this on will log to the ~/zwave/ directory. The log file name starts with zwavejs2mqtt and has the date appended to the name.
Z-Wave
Serial Port - /dev/zwave - This can be tricky. Be SURE, in the command line, you specify the path to your device in /dev/serial/by-id/ as shown in the command line above. The “–device” option in that docker command tells Docker to use that as the real device, but maps it to /dev/zwave within the Docker environment. (This confused the heck out of me and took me hours to get!)
The rest of the Z-Wave settings are up to you. If you leave Statistics enabled, it helps he developers.
Disable MQTT Gateway
If you’re new to all this, yes, disable it. Click this to on. It’s FAR easier to just use the Home Assistant setup where HA will discover this automatically. If you want to use the MQTT gateway later (or now), you can set it up, but it’s just extra stuff for most people.
Home Assistant
WS Server All you need to do in this section is click to enable the WS (Web Socket) server. Then HA should be able to find this on its own.
You can do more with the settings, I’m just trying to include what it takes to get up and running.