Increasing instability in zwave.js?

I only have one item connected to the zwave stick, my danalock.
But I see an increase in the crashes in the zwave.js, has anybody else noticed this?

I just snapped a part of the last log:

2021-09-11T15:03:05.892Z DRIVER   Serial port errored: The serial port closed unexpectedly!
Error in driver ZWaveError: The serial port closed unexpectedly!
    at SerialPort.<anonymous> (/usr/src/node_modules/@zwave-js/serial/src/ZWaveSerialPort.ts:39:10)
    at SerialPort.emit (events.js:400:28)
    at SerialPort.emit (domain.js:470:12)
    at binding.close.then.closing (/usr/src/node_modules/@serialport/stream/lib/index.js:435:12) {
  code: 5,
  context: undefined,
  transactionSource: undefined
}
Z-Wave error ZWaveError: The driver is not ready or has been destroyed
    at Driver.ensureReady (/usr/src/node_modules/zwave-js/src/lib/driver/Driver.ts:1553:10)
    at Driver.sendMessage (/usr/src/node_modules/zwave-js/src/lib/driver/Driver.ts:2622:8)
    at Driver.sendCommand (/usr/src/node_modules/zwave-js/src/lib/driver/Driver.ts:2828:28)
    at DoorLockCCAPI.set (/usr/src/node_modules/zwave-js/src/lib/commandclass/DoorLockCC.ts:292:21)
    at Proxy.DoorLockCCAPI.<computed> (/usr/src/node_modules/zwave-js/src/lib/commandclass/DoorLockCC.ts:140:15)
    at ZWaveNode.setValue (/usr/src/node_modules/zwave-js/src/lib/node/Node.ts:799:14)
    at Function.handle (/usr/src/node_modules/@zwave-js/server/dist/lib/node/message_handler.js:19:44)
    at Object.node (/usr/src/node_modules/@zwave-js/server/dist/lib/server.js:38:91)
    at Client.receiveMessage (/usr/src/node_modules/@zwave-js/server/dist/lib/server.js:93:99)
    at WebSocket.<anonymous> (/usr/src/node_modules/@zwave-js/server/dist/lib/server.js:46:45) {
  code: 8,
  context: undefined,
  transactionSource: undefined
}
Z-Wave error ZWaveError: The driver is not ready or has been destroyed
    at Driver.ensureReady (/usr/src/node_modules/zwave-js/src/lib/driver/Driver.ts:1553:10)
    at Driver.sendMessage (/usr/src/node_modules/zwave-js/src/lib/driver/Driver.ts:2622:8)
    at Driver.sendCommand (/usr/src/node_modules/zwave-js/src/lib/driver/Driver.ts:2828:28)
    at DoorLockCCAPI.set (/usr/src/node_modules/zwave-js/src/lib/commandclass/DoorLockCC.ts:292:21)
    at Proxy.DoorLockCCAPI.<computed> (/usr/src/node_modules/zwave-js/src/lib/commandclass/DoorLockCC.ts:140:15)
    at ZWaveNode.setValue (/usr/src/node_modules/zwave-js/src/lib/node/Node.ts:799:14)
    at Function.handle (/usr/src/node_modules/@zwave-js/server/dist/lib/node/message_handler.js:19:44)
    at Object.node (/usr/src/node_modules/@zwave-js/server/dist/lib/server.js:38:91)
    at Client.receiveMessage (/usr/src/node_modules/@zwave-js/server/dist/lib/server.js:93:99)
    at WebSocket.<anonymous> (/usr/src/node_modules/@zwave-js/server/dist/lib/server.js:46:45) {
  code: 8,
  context: undefined,
  transactionSource: undefined
}

I can restart the module without issues, every time, and then the lock works again.

System info? How do you run HA/type of install?

1 Like

core-2021.9.5

On a NUC i5 with proxmox.
USB z-wave dongle is a AEOTEC connected via USB2 cable.

I don’t use Proxmox, but to me the log indicates the zwavejs add on is losing connection to the physical zwave usb stick.

When you run a vm, the usb stick has to travel through multiple “layers” to get to the addon.

Basically you have physical connections from the zwave usb sticks itself- connection to the usb cable, usb cable itself, and connection to the Nuc. Then you have software connections to the parent OS running on the Nuc (which I believeProxmox serves both as an OS and VM in this case), Mapping from the parent OS to the Home-assistant OS running on the virtual machine, then another mapping from the home assistant OS into the zwavejs addon, which is actually running in a docker container.

A connection failure can occur at any one of these multiple failure points, and close the serial port. Id start with the easy physical connections. Do any of the plugs feel loose? Maybe just a new cable will fix it. Try a different usb port. While more common on an rpi, too many plugged in usb devices could result in a lack of usb power and devices failing. A powered usb hub can fix that .

Then check your proxmox usb settings- hopefully someone can chime in on how to set those best since I’m not familiar with them.

I run homeassistant container and zwavejs2mqtt in another docker container I installed myself (not the addon) and have “restart always”, so if the container has a momentary loss of connection to the usb, it will automatically attempt to restart. I don’t know if the addons are setup this way, or can be configured to “restart always”. Being able to manage the config and how the containers run is a definite advantage to running Homeassistant container vs Home-assistant OS, where advanced config settings are more locked down.

1 Like

Proxmox is notorious for dropping the USB passthru from the host, make sure the USB 3.0 checkbox isn’t checked on the virtual machine.

2 Likes

Hmm, weird, I’ve been using proxmox for years now, and it’s only lately I’m starting to see this problem, definetely getting way worse lately, and it only started after going zwave.js, never saw it before that.
The cable and usb plug are tied to a rack, and doesn’t move, so unless an elf is getting into the locked rack, and jiggles stuff, then I wouldn’t consider a plug getting loose all of the sudden :smiley:

Well you’ve clearly ruled out a physical connection issue then. While its easy to just blame zwavejs here, and it can’t be ruled out as part of the problem, there remains many other places things can go wrong. While you’ve been using proxmox for years, Home Assistant has only used zwavejs for less then a year, so it is a relatively new integration. Even if you used proxmox before with openzwave or something else, this program works in a slightly different way. Openzwave was more integrated into Home Assistant, where zwavejs is an addon outside of Home Assistant core. Not saying that’s bad, just saying it changed the rules of the game versus an old setup that might have been fine before, and added another “layer” you are dealing with for passing the USB through.

I’ve been using zwavejs2mqtt in a docker container since around March, and I’ve never had the USB disconnect. I’m using the Aeotec zstick z5. If using the zwavejs addon maybe you want to give zwavejs2mqtt a try instead.

While I’ve seen posts detailing initial setup difficulties with the usb and zwavejs, I don’t see too many other posts with people having issues with USB disconnects with zwavejs. Also, if a lot of other users were having this issue, you would see multiple posts from people saying “yeah me too”. Here we are 4 days since the initial post, and no one else has reported a similar issue.

I do however see multiple posts across many forums of people having issues with usb pass through with Proxmox though, and as @firstof9 pointed out, its a common problem, so I’d tend to think the issue is on that end, but we just don’t have enough information to know for sure. On a linux box I would advise someone to run “dmesg | grep usb” to look for errors and messages related to usb in the system, but diagnosing this on a Proxmox system is something I unfortunately don’t have experience with.

1 Like

It could very well be one of the potential problems you mention, I’m going to try and work through the setup, fortunately I only have 1 zwave device, and just to be clear, I didn’t state that problems were increasing in general as a fact, it was stated as a question.
And with the excellent and super thorough answers I’ve received I can see that it is not the general sentiments.
So I’ll walk throught the connections, clean them, maybe replace the USB2 cable, just to make sure, and then I’ll consider the zwavejs2mqtt, proxmox does not supply docker, but lxc, so it’s not a shoe-in in that way, and it seems rather silly to setup an entire server, and run docker on it, even though it’s virtual.

1 Like

Sorry I should have been a little clearer I this - I meant try zwavejs2mqtt as a “community addon” first instead of the “official” zwavejs addon, since that would stay within the VM/server running the Home Assistant environment. The addons are both based on zwavejs but work in a slightly different way, and the zwavejs2mqtt addon gives you a control panel with more access to troubleshooting tools.

I don’t have the addons with my container install/environment so that’s why I run it in a separate docker container. Having to setup another entire server in your situation is probably not ideal.

Here’s more info on the addon version of zwavejs2mqtt

1 Like

I’ve recently switched from legacy HA ZWave addon to ZWaveJS. I’m using the same Aotec ZWave USB stick on a raspberry pi 3 running Home Assistant OS.
While I never had issues with the Aotec stick for more than year with the legacy ZWave addon, I now loose connection with the stick at least once a week with ZWaveJS, requiring a full reboot of the host (just restarting HA core or reloading the add-on does not help).
So, to answer the original question, I do see instability with the official ZWaveJS addon. In my case I have more than 20 ZWave devices, which makes the problem very frustrating.
Not sure how to investigate this is, as there are not many options to browse the lower level logs to find details after a connection loss.