Skip to content

[zwavejs] If websocket connection is dropped, reconnect is only tried once #20250

@seanch80

Description

@seanch80

Expected Behavior

If the first websocket reconnect attempt after 2 minutes isn't successful, further reconnect attempts should be made.

Current Behavior

When the websocket connection is dropped, a reconnect attempt is tried after 2 minutes, but if that fails, after that nothing happens, so if for instance the zwavejs docker container is down for more than 2 minutes, the connection is never regained and everything is offline in openhab until the operator intervenes.

2026-02-18 12:39:45.731 [DEBUG] [g.zwavejs.internal.api.ZWaveJSClient] - onWebSocketClose(1005, ‘null’)
2026-02-18 12:39:45.733 [INFO ] [g.zwavejs.internal.api.ZWaveJSClient] - Scheduling reconnect to Z-Wave JS Webservice every 2 minutes
2026-02-18 12:41:45.734 [DEBUG] [g.zwavejs.internal.api.ZWaveJSClient] - Connecting to Z-Wave JS Webservice
2026-02-18 12:41:45.738 [DEBUG] [g.zwavejs.internal.api.ZWaveJSClient] - Error during websocket communication: Connection refused

These are the zwavejs DEBUG logs. In this example I stopped the zwavejs docker container explicitly. After 2 minutes, an automatic reconnect attempt was made, but since it took me more than 2 minutes to start zwavejs up again, that reconnect attempt failed.

The bug is that there are no further reconnect attempts being made after the first one, no matter how long you wait. The only way to get it working again is to disable/enable the zwavejs Bridge Thing or restarting openhab.

When I copy / pasted this log out I had been waiting over 20 minutes, and no further log messages were written.

I have made a temporary workaround using a javascript rule that automates disabling / enabling the bridge Thing, but hopefully that is just temporary.

I posted this to the forum first, and was told to submit an issue here:
https://community.openhab.org/t/z-wave-js-binding-only-tries-to-reconnect-once/168545

Steps to Reproduce (for Bugs)

  1. Stop zwavejs
  2. Wait more than 2 minutes
  3. Start zwavejs
  4. Observe the zwavejs binding not reconnecting and the bridge and all devices being offline.

I have verified that reconnection works if zwavejs is back up again in under 2 minutes.

Context

Today I was testing different USB-A extension cables for the Z-stick, and I stopped the zwavejs docker container beforehand, and it took me 3-4 minutes to get it started again.

I also have a specialized Docker container restart system going, and it is not guaranteed that containers are restarted in 2 minutes time always in daily use.

So with manual tests, obviously I can repair it myself, but there are also situations where I could had a completely dead Z-Wave installation, if the initial reconnect fails, and then no more reconnects happen after that.

When testing with a 700 series controller last week I also had an instance where zwavejs froze completely after repeated errors, and in that case also more than 2 minutes would hae passed until the websocket was up again.

It says in the logs that it will try reconnecting every 2 minutes, but for me at least it only tries once.

Your Environment

I run everything in Docker on a Pentium N3700 mini-PC with 4GB RAM and 256GB SSD.
OS: Ubuntu 22.04.5 LTS
Docker version 28.2.2, build 28.2.2-0ubuntu1~22.04.1
Relevant containers:

  • openhab/openhab:5.1.2
  • zwavejs/zwave-js-ui:11.11.0 (zwavejs driver version 15.20.1)

I have configured everything in openhab using files, including the zwave js bridge and all Things and Items.

I am using a custom websocket port number 8092 insead of 3000, but I wouldn't expect that to matter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn unexpected problem or unintended behavior of an add-on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions