zwave-js / zwave-js-ui

Full featured Z-Wave Control Panel UI and MQTT gateway. Built using Nodejs, and Vue/Vuetify
https://zwave-js.github.io/zwave-js-ui
MIT License
987 stars 201 forks source link

Failed to open serial port for HUSBZB-1 using Docker on RazPi 3B #2770

Closed brystmar closed 2 years ago

brystmar commented 2 years ago

Checklist

Deploy method

Docker

Z-Wave JS UI version

8.2.2.4dd1414

ZwaveJS version

10.3.0

Describe the bug

When starting the container, it throws an error message about not being able to open the serial port, then appears to restart the service restarts every 12 seconds. I see error messages in both the Raspberry Pi terminal, and in red at the top of the UI.

DRIVER Failed to open the serial port: Error: No such file or directory, cannot open /dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Controller_71600111-if00-port0

The UI loads properly so I can navigate around and update settings, so I'm unsure if this is an issue with the UI or the backend.

The serial port name is copy/pasted directly from File Manager. I even tried setting /dev/ttyUSB0 as the Z-Wave serial port in the UI, which throws the same error.

I suspect this is a container permissions issue, but I don't know enough about containers to troubleshoot.

To Reproduce

Raspberry Pi 3B running Raspbian GNU/Linux 10 (buster). Per #2725, I also installed libseccomp2

  1. Open the terminal on Raspberry Pi
  2. Enter the below docker run command:
docker run --rm -it -p 8091:8091 -p 3000:3000 -e TZ=Americas/Los_Angeles --device=/dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Controller_71600111-if00-port0:/dev/zwave \
--mount source=zwave-js-ui,target=/usr/src/app/store zwavejs/zwave-js-ui:latest

Expected behavior

I'd expect to not see the service throw errors and restart every ~12s. Eventual goal is for this Z-Wave stick to work with HASS, but we're definitely a few steps away from even thinking about that yet.

Additional context

Driver logs:

2022-10-28 17:03:09.824 INFO Z-WAVE: Connecting to /dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Controller_71600111-if00-port0
17:03:09.827 DRIVER ███████╗ ██╗ ██╗ █████╗ ██╗ ██╗ ███████╗ ██╗ ███████╗
╚══███╔╝ ██║ ██║ ██╔══██╗ ██║ ██║ ██╔════╝ ██║ ██╔════╝
███╔╝ ██║ █╗ ██║ ███████║ ██║ ██║ █████╗ █████╗ ██║ ███████╗
███╔╝ ██║███╗██║ ██╔══██║ ╚██╗ ██╔╝ ██╔══╝ ╚════╝ ██ ██║ ╚════██║
███████╗ ╚███╔███╔╝ ██║ ██║ ╚████╔╝ ███████╗ ╚█████╔╝ ███████║
╚══════╝ ╚══╝╚══╝ ╚═╝ ╚═╝ ╚═══╝ ╚══════╝ ╚════╝ ╚══════╝
17:03:09.830 DRIVER version 10.3.0
17:03:09.832 DRIVER
17:03:09.833 DRIVER starting driver...
17:03:09.851 DRIVER opening serial port /dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Control
ler_71600111-if00-port0
17:03:18.890 DRIVER Failed to open the serial port: Error: No such file or directory, cannot open
/dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Controller_71600111-if00-po
rt0
17:03:18.894 DRIVER destroying driver instance...
2022-10-28 17:03:18.897 WARN Z-WAVE: Retry connection in 3 seconds...
17:03:18.899 DRIVER driver instance destroyed
2022-10-28 17:03:21.916 INFO Z-WAVE: Connecting to /dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Controller_71600111-if00-port0
17:03:21.920 DRIVER ███████╗ ██╗ ██╗ █████╗ ██╗ ██╗ ███████╗ ██╗ ███████╗
╚══███╔╝ ██║ ██║ ██╔══██╗ ██║ ██║ ██╔════╝ ██║ ██╔════╝
███╔╝ ██║ █╗ ██║ ███████║ ██║ ██║ █████╗ █████╗ ██║ ███████╗
███╔╝ ██║███╗██║ ██╔══██║ ╚██╗ ██╔╝ ██╔══╝ ╚════╝ ██ ██║ ╚════██║
███████╗ ╚███╔███╔╝ ██║ ██║ ╚████╔╝ ███████╗ ╚█████╔╝ ███████║
╚══════╝ ╚══╝╚══╝ ╚═╝ ╚═╝ ╚═══╝ ╚══════╝ ╚════╝ ╚══════╝
17:03:21.924 DRIVER version 10.3.0
17:03:21.926 DRIVER
17:03:21.928 DRIVER starting driver...
17:03:21.953 DRIVER opening serial port /dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Control
ler_71600111-if00-port0
17:03:30.991 DRIVER Failed to open the serial port: Error: No such file or directory, cannot open
/dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Controller_71600111-if00-po
rt0
17:03:30.996 DRIVER destroying driver instance...
2022-10-28 17:03:31.001 WARN Z-WAVE: Retry connection in 3 seconds...
17:03:31.003 DRIVER driver instance destroyed
2022-10-28 17:03:34.037 INFO Z-WAVE: Connecting to /dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Controller_71600111-if00-port0
17:03:34.041 DRIVER ███████╗ ██╗ ██╗ █████╗ ██╗ ██╗ ███████╗ ██╗ ███████╗
╚══███╔╝ ██║ ██║ ██╔══██╗ ██║ ██║ ██╔════╝ ██║ ██╔════╝
███╔╝ ██║ █╗ ██║ ███████║ ██║ ██║ █████╗ █████╗ ██║ ███████╗
███╔╝ ██║███╗██║ ██╔══██║ ╚██╗ ██╔╝ ██╔══╝ ╚════╝ ██ ██║ ╚════██║
███████╗ ╚███╔███╔╝ ██║ ██║ ╚████╔╝ ███████╗ ╚█████╔╝ ███████║
╚══════╝ ╚══╝╚══╝ ╚═╝ ╚═╝ ╚═══╝ ╚══════╝ ╚════╝ ╚══════╝
17:03:34.043 DRIVER version 10.3.0
17:03:34.046 DRIVER
17:03:34.050 DRIVER starting driver...
17:03:34.070 DRIVER opening serial port /dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Control
ler_71600111-if00-port0

Here's my UI settings file w/keys truncated, in case it helps:

{
  "mqtt": {
    "name": "zwave-js-ui",
    "host": "localhost",
    "port": 1883,
    "qos": 1,
    "prefix": "zwave",
    "reconnectPeriod": 3000,
    "retain": true,
    "clean": true,
    "auth": false,
    "_ca": "",
    "ca": "",
    "_cert": "",
    "cert": "",
    "_key": "",
    "key": "",
    "disabled": true
  },
  "gateway": {
    "type": 0,
    "plugins": [],
    "authEnabled": false,
    "payloadType": 0,
    "nodeNames": true,
    "hassDiscovery": false,
    "discoveryPrefix": "homeassistant",
    "logEnabled": true,
    "logLevel": "silly",
    "logToFile": false,
    "values": []
  },
  "zwave": {
    "port": "/dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Controller_71600111-if00-port0",
    "commandsTimeout": 30,
    "logLevel": "silly",
    "logEnabled": true,
    "securityKeys": {
      "S0_Legacy": "secret",
      "S2_Unauthenticated": "secret",
      "S2_Authenticated": "secret",
      "S2_AccessControl": "secret"
    },
    "deviceConfigPriorityDir": "/usr/src/app/store/config",
    "logToFile": false,
    "serverEnabled": true,
    "serverServiceDiscoveryDisabled": false,
    "enableSoftReset": true,
    "enableStatistics": true,
    "serverPort": 3000,
    "maxNodeEventsQueueSize": 100,
    "higherReportsTimeout": false,
    "disclaimerVersion": 1,
    "scales": []
  },
  "backup": {
    "storeBackup": false,
    "storeCron": "0 0 * * *",
    "storeKeep": 7,
    "nvmBackup": false,
    "nvmBackupOnEvent": false,
    "nvmCron": "0 0 * * *",
    "nvmKeep": 7
  }
}
kpine commented 2 years ago

Your USB path in settings is incorrect. You've mapped the device as /dev/zwave inside the container. Your configuration should use /dev/zwave.

brystmar commented 2 years ago

Ahh, so because I mapped the device to /dev/zwave in the docker run command, I should use that mapped location as the path to the serial port. Learning new things every day, thank you :)