Zwavejs2mqtt snap package

Hi,

that is not the correct way. Since snap is running within an isolated environment you need to give it access to specific interfaces.

You either need to use the raw-usb or the serial-port interface. And you're connecting them like this:

sudo snap connect zwavejs2mqtt:raw-usb

or

sudo snap connect zwavejs2mqtt:serial-port

Using the serial port

The latter one, which I think you need to use, requires hot-plug support to be enabled first:

sudo snap set system experimental.hotplug=true
sudo systemctl restart snapd

If you have a valid serial device and its available to snapd it should be listed under «slots» by the following command:

snap interface serial-port

My list is like this

name:    serial-port
summary: allows accessing a specific serial port
plugs:
  - zwavejs2mqtt
slots:
  - snapd:aeotecz-stickgen5zw0 (allows accessing a specific serial port)

Look at it as plugs (e.g zwavejs2mqtt) is the consumer and slots (your device) as the producer, that can be connected accordingly.

Now connect to the one you have, in my case it's snapd:aeotecz-stickgen5zw0, to Z2M:

sudo snap connect zwavejs2mqtt:serial-port <slot name>

(swap <slot name> with the name of your device)

Set the device-path in the settings

Now remember to edit zwave details in the settings. This can be done by accessing http://<hostname>:8091/settings where hostname could be localhost if it's a local instance or the IP of the host if its running on another machine.

The service must of course be running to access it, either

  • as a background daemon: sudo zwavejs2mqtt.daemonize
  • in the foreground: sudo zwavejs2mqtt.exec

The second will exit the application when you exit the command, while the daemon will auto-start on boot and keep the process running in the background. Do not use both at the same time!

However if you just installed Z2M and are debugging and restarting the app frequently, the foreground method is nice.

You'll get the output directly in your terminal - most likely with colors.

For the background service you can access logs with

sudo snap logs zwavejs2mqtt -f

(note the -f = follow)

Set the device-path through the shell

An alternative method to set the device is to edit the settings.json file within the shell of the application, like this:

sudo snap run --shell zwavejs2mqtt
cat <<< $(jq '.zwave.port="/dev/ttyACM0"' $SNAP_DATA/settings.json) > $SNAP_DATA/settings.json

(swap out /dev/ttyACM0 with your device, e.g /dev/ttyAMA0)

Now exit the shell and restart zwavejs2mqtt with

exit
sudo snap restart zwavejs2mqtt