zwave-js-ui icon indicating copy to clipboard operation
zwave-js-ui copied to clipboard

[question] Issue when selecting USB port "by-id" and connecting to Zwave-stick

Open ZonPV opened this issue 3 years ago • 1 comments

Running Zwavejs2MQTT in latest docker on RPI 4 with Aeotec Z-Stick Gen5 (ZW090). Running fine for months, since a few days no connection: Driver: Failed to open the serial port: Error: No such file or directory, cannot open /dev/serial/by-id/usb-0658_0200-if00 (ZW0100) Reboot didn't help. New install of the docker-container either.

This is output of command udevadm:

pi@raspberrypi:~/zwavejs2mqtt $ udevadm info -q property -n /dev/serial/by-id/usb-0658_0200-if00
DEVPATH=/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4.3/1-1.4.3:1.0/tty/ttyACM0
DEVNAME=/dev/ttyACM0
MAJOR=166
MINOR=0
SUBSYSTEM=tty
USEC_INITIALIZED=8139810
ID_BUS=usb
ID_VENDOR_ID=0658
ID_MODEL_ID=0200
ID_PCI_CLASS_FROM_DATABASE=Serial bus controller
ID_PCI_SUBCLASS_FROM_DATABASE=USB controller
ID_PCI_INTERFACE_FROM_DATABASE=XHCI
ID_VENDOR_FROM_DATABASE=Sigma Designs, Inc.
ID_MODEL_FROM_DATABASE=Aeotec Z-Stick Gen5 (ZW090) - UZB
ID_VENDOR=0658
ID_VENDOR_ENC=0658
ID_MODEL=0200
ID_MODEL_ENC=0200
ID_REVISION=0000
ID_SERIAL=0658_0200
ID_TYPE=generic
ID_USB_INTERFACES=:020201:0a0000:
ID_USB_INTERFACE_NUM=00
ID_USB_DRIVER=cdc_acm
ID_USB_CLASS_FROM_DATABASE=Communications
ID_PATH=platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.4.3:1.0
ID_PATH_TAG=platform-fd500000_pcie-pci-0000_01_00_0-usb-0_1_4_3_1_0
DEVLINKS=/dev/serial/by-id/usb-0658_0200-if00 /dev/serial/by-path/platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.4.3:1.0
TAGS=:systemd:

This is the docker-compose.yml:

version: '3.7'
services:
  zwavejs2mqtt:
    container_name: zwavejs2mqtt
    image: zwavejs/zwavejs2mqtt:latest
    restart: always
    tty: true
    stop_signal: SIGINT
    environment:
      - SESSION_SECRET=mysupersecretkey
      - ZWAVEJS_EXTERNAL_CONFIG=/usr/src/app/store/.config-db
      # Uncomment if you want logs time and dates to match your timezone instead of UTC
      # Available at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
      - TZ=Europe/Amsterdam
    networks:
      - zwave
    devices:
      # Do not use /dev/ttyUSBX serial devices, as those mappings can change over time.
      # Instead, use the /dev/serial/by-id/X serial device for your Z-Wave stick.
      - '/dev/serial/by-id/usb-0658_0200-if00:/dev/zwave'
      # - '/dev/ttyACM0:/dev/zwave'
    volumes:
      - zwave-config:/usr/src/app/store
    ports:
      - '8091:8091' # port for web interface
      - '3000:3000' # port for Z-Wave JS websocket server
networks:
  zwave:
volumes:
  zwave-config:
    name: zwave-config

Did a factory-reset of the Aeotec Z-Stick Gen5 (ZW090). There is a file named usb-0658_0200-if00 in the path /dev/serial/by-id (created by the host) Soft reset is off/disabled

In the browser the software says: connected. The textballoon in the browser talks about a ZW100. The stick says it is a ZW090.

Maybe that is a cause?

There were no problems in the past.

Any idea's to get the software running again? Thx in advance!

ZonPV avatar Aug 14 '22 15:08 ZonPV

Running fine for months, since a few days no connection: Driver: Failed to open the serial port: Error: No such file or directory, cannot open /dev/serial/by-id/usb-0658_0200-if00 (ZW0100)

That error means your zwavejs2mqtt is configured to use the path /dev/serial/by-id/usb-0658_0200-if00. However, your docker compose file shows that you are mapping the USB path into the container as /dev/zwave. If that's the case, your zwavejs2mqtt configuration should use /dev/zwave, not /dev/serial/by-id/usb-0658_0200-if00. Based on the provided information, you have a configuration issue.

If the docker compose you posted is not accurate, you'll have to provide the correct docker installation information.

kpine avatar Aug 14 '22 17:08 kpine

@kpine Thank you for reply. I saw that solution in another issue. Tried it but did not solve my problem. Sorry I did not mention it.

This is the error: Driver: Failed to initialize the driver: ZWaveError: Timeout while waiting for an ACK from the controller (ZW0200) at Driver.sendMessage (/usr/src/app/node_modules/zwave-js/src/lib/driver/Driver.ts:3547:23) at ZWaveController.identify (/usr/src/app/node_modules/zwave-js/src/lib/controller/Controller.ts:736:33) at Driver.initializeControllerAndNodes (/usr/src/app/node_modules/zwave-js/src/lib/driver/Driver.ts:1117:26) at Immediate. (/usr/src/app/node_modules/zwave-js/src/lib/driver/Driver.ts:924:16) (ZW0100)

Zwave-USB-error

I did not exactly understand your last sentence but here the actual docker-compose.yml:

version: '3.7'
services:
  zwavejs2mqtt:
    container_name: zwavejs2mqtt
    image: zwavejs/zwavejs2mqtt:latest
    restart: always
    tty: true
    stop_signal: SIGINT
    environment:
      - SESSION_SECRET=mysupersecretkey
      - ZWAVEJS_EXTERNAL_CONFIG=/usr/src/app/store/.config-db
      # Uncomment if you want logs time and dates to match your timezone instead of UTC
      # Available at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
      - TZ=Europe/Amsterdam
    networks:
      - zwave
    devices:
      # Do not use /dev/ttyUSBX serial devices, as those mappings can change over time.
      # Instead, use the /dev/serial/by-id/X serial device for your Z-Wave stick.
      - '/dev/serial/by-id/usb-0658_0200-if00:/dev/zwave'
    volumes:
      - zwave-config:/usr/src/app/store
    ports:
      - '8091:8091' # port for web interface
      - '3000:3000' # port for Z-Wave JS websocket server
networks:
  zwave:
volumes:
  zwave-config:
    name: zwave-config

ZonPV avatar Aug 14 '22 19:08 ZonPV

There seems to be some progress now:

This is last part of the logfile:

2022-08-14T19:15:01.526Z CNTRLR   received additional controller information:
                                    Z-Wave API version:         5 (legacy)
                                    Z-Wave chip type:           ZW050x
                                    node type                   Controller
                                    controller role:            primary
                                    controller is the SIS:      true
                                    controller supports timers: false
                                    nodes in the network:       1
2022-08-14T19:15:01.536Z DRIVER   Cache file for homeId 0xc19fc5c5 found, attempting to restore the network from
                                   cache...
2022-08-14T19:15:01.648Z CNTRLR   [Node 001] Embedded device config loaded
2022-08-14T19:15:01.651Z DRIVER   Restoring the network from cache was successful!
2022-08-14T19:15:01.659Z CNTRLR   [Node 001] [Manufacturer Specific] manufacturerId: metadata updated
2022-08-14T19:15:01.660Z CNTRLR   [Node 001] [Manufacturer Specific] productType: metadata updated
2022-08-14T19:15:01.661Z CNTRLR   [Node 001] [Manufacturer Specific] productId: metadata updated
2022-08-14T19:15:01.663Z CNTRLR   [Node 001] [~] [Manufacturer Specific] manufacturerId: 134 => 134
2022-08-14T19:15:01.664Z CNTRLR   [Node 001] [~] [Manufacturer Specific] productType: 1 => 1
2022-08-14T19:15:01.665Z CNTRLR   [Node 001] [~] [Manufacturer Specific] productId: 90 => 90
2022-08-14T19:15:01.667Z CNTRLR   [Node 001] [Version] firmwareVersions: metadata updated
2022-08-14T19:15:01.667Z CNTRLR   [Node 001] [~] [Version] firmwareVersions: 1.0 => 1.0
2022-08-14T19:15:01.668Z CNTRLR   [Node 001] [Version] sdkVersion: metadata updated
2022-08-14T19:15:01.669Z CNTRLR   [Node 001] [~] [Version] sdkVersion: "3.95.0" => "3.95.0"
2022-08-14T19:15:01.670Z CNTRLR   setting serial API timeouts: ack = 1000 ms, byte = 150 ms
2022-08-14T19:15:01.684Z SERIAL » 0x01050006640f97                                                     (7 bytes)
2022-08-14T19:15:01.685Z DRIVER » [REQ] [SetSerialApiTimeouts]
                                    payload: 0x640f
2022-08-14T19:15:01.687Z SERIAL « [ACK]                                                                   (0x06)
2022-08-14T19:15:01.689Z SERIAL « 0x01050106960f64                                                     (7 bytes)
2022-08-14T19:15:01.690Z SERIAL » [ACK]                                                                   (0x06)
2022-08-14T19:15:01.691Z DRIVER « [RES] [SetSerialApiTimeouts]
                                    payload: 0x960f
2022-08-14T19:15:01.696Z CNTRLR   serial API timeouts overwritten. The old values were: ack = 1500 ms, byte = 15
                                  0 ms
2022-08-14T19:15:01.696Z CNTRLR   Interview completed
2022-08-14T19:15:01.697Z DRIVER   No network key for S0 configured, communication with secure (S0) devices won't
                                   work!
2022-08-14T19:15:01.697Z DRIVER   No network key for S2 configured, communication with secure (S2) devices won't
                                   work!
2022-08-14T19:15:01.697Z DRIVER   driver ready
2022-08-14T19:15:01.699Z DRIVER   Checking for configuration updates...
2022-08-14T19:15:01.779Z CNTRLR   [Node 001] The node is alive.
2022-08-14T19:15:01.785Z CNTRLR   [Node 001] The node is ready to be used
2022-08-14T19:15:01.786Z CNTRLR   All nodes are ready to be used
2022-08-14T19:15:01.986Z DRIVER   Usage statistics sent - next transmission scheduled in 23 hours.
2022-08-14T19:15:02.873Z DRIVER   No configuration update available...

So there is one object now in the control panel. Up till now no success in adding nodes...

ZonPV avatar Aug 14 '22 19:08 ZonPV

Lots of problems to communicate with the Zwave controller... Had the node in control panel but now it is lost suddenly. Tried to included a node...

This is at the end of the logfile:


2022-08-14T19:50:00.477Z DRIVER » [REQ] [GetControllerId]
2022-08-14T19:50:01.480Z CNTRLR   Failed to execute controller command after 2/3 attempts. Scheduling next try i
                                  n 1100 ms.
2022-08-14T19:50:02.581Z SERIAL » 0x01030020dc                                                         (5 bytes)
2022-08-14T19:50:02.583Z DRIVER » [REQ] [GetControllerId]
2022-08-14T19:50:03.593Z DRIVER   Failed to initialize the driver: ZWaveError: Timeout while waiting for an ACK 
                                  from the controller (ZW0200)
                                      at Driver.sendMessage (/usr/src/app/node_modules/zwave-js/src/lib/driver/D
                                  river.ts:3547:23)
                                      at ZWaveController.identify (/usr/src/app/node_modules/zwave-js/src/lib/co
                                  ntroller/Controller.ts:736:33)
                                      at Driver.initializeControllerAndNodes (/usr/src/app/node_modules/zwave-js
                                  /src/lib/driver/Driver.ts:1117:26)
                                      at Immediate.<anonymous> (/usr/src/app/node_modules/zwave-js/src/lib/drive
                                  r/Driver.ts:924:16)
2022-08-14T19:50:03.594Z DRIVER   destroying driver instance...
2022-08-14T19:50:03.596Z DRIVER   driver instance destroyed
2022-08-14T19:50:03.606Z DRIVER   ███████╗ ██╗    ██╗  █████╗  ██╗   ██╗ ███████╗             ██╗ ███████╗
                                  ╚══███╔╝ ██║    ██║ ██╔══██╗ ██║   ██║ ██╔════╝             ██║ ██╔════╝
                                    ███╔╝  ██║ █╗ ██║ ███████║ ██║   ██║ █████╗   █████╗      ██║ ███████╗
                                   ███╔╝   ██║███╗██║ ██╔══██║ ╚██╗ ██╔╝ ██╔══╝   ╚════╝ ██   ██║ ╚════██║
                                  ███████╗ ╚███╔███╔╝ ██║  ██║  ╚████╔╝  ███████╗        ╚█████╔╝ ███████║
                                  ╚══════╝  ╚══╝╚══╝  ╚═╝  ╚═╝   ╚═══╝   ╚══════╝         ╚════╝  ╚══════╝
2022-08-14T19:50:03.606Z DRIVER   version 9.6.2
2022-08-14T19:50:03.606Z DRIVER   
2022-08-14T19:50:03.607Z DRIVER   starting driver...
2022-08-14T19:50:03.611Z DRIVER   opening serial port /dev/zwave
2022-08-14T19:50:03.619Z DRIVER   serial port opened
2022-08-14T19:50:03.620Z SERIAL » [NAK]                                                                   (0x15)
2022-08-14T19:50:03.621Z DRIVER   loading configuration...
2022-08-14T19:50:03.625Z CONFIG   Using external configuration dir /usr/src/app/store/.config-db
2022-08-14T19:50:03.627Z CONFIG   version 9.6.1
2022-08-14T19:50:04.697Z DRIVER   beginning interview...
2022-08-14T19:50:04.697Z DRIVER   added request handler for AddNodeToNetwork (0x4a)...
                                  1 registered
2022-08-14T19:50:04.698Z DRIVER   added request handler for RemoveNodeFromNetwork (0x4b)...
                                  1 registered
2022-08-14T19:50:04.698Z DRIVER   added request handler for ReplaceFailedNode (0x63)...
                                  1 registered
2022-08-14T19:50:04.698Z CNTRLR   querying controller IDs...
2022-08-14T19:50:04.705Z SERIAL » 0x01030020dc                                                         (5 bytes)
2022-08-14T19:50:04.706Z DRIVER » [REQ] [GetControllerId]
2022-08-14T19:50:05.708Z CNTRLR   Failed to execute controller command after 1/3 attempts. Scheduling next try in 100 ms.
2022-08-14T19:50:05.811Z SERIAL » 0x01030020dc                                                         (5 bytes)
2022-08-14T19:50:05.812Z DRIVER » [REQ] [GetControllerId]
2022-08-14T19:50:06.814Z CNTRLR   Failed to execute controller command after 2/3 attempts. Scheduling next try in 1100 ms.

And this is status of Docker container:

pi@raspberrypi:~/zwavejs2mqtt $ sudo docker-compose top
zwavejs2mqtt
UID    PID    PPID   C    STIME   TTY     TIME             CMD        
----------------------------------------------------------------------
root   1598   1515   12   21:05   ?     00:05:38   node server/bin/www

ZonPV avatar Aug 14 '22 19:08 ZonPV

Some followup: Problem solved! I was running this app in Docker on my Syno. As said, it was running oke for months. Suddenly stopped and build a testserver on a Pi... Simular problems... Searching on the web I read about High privileges for a container.... Tried on my Syno and that was the trick!

Thnx for your help anyway.

ZonPV avatar Aug 15 '22 14:08 ZonPV

@ZonPV Glad your issues has been fixed. In case of connectivity problems another stupid yet very effective solution is to add an extension usb cable to your zwave stick

robertsLando avatar Aug 29 '22 09:08 robertsLando