Z-Wave JS reboot issue - docker command?

I finally migrated from openzwave to Z-Wave JS. Both HA and zwavejs2mqtt is running on docker on my server. I disabled MQTT in zwavejs2mqtt, and am using the HA integration to manage it.

When the server is rebooted, or when docker is rebooted I am experiencing issues with Z-Wave. In particular, some of the devices “loose” some of their entities, or the nodes come up in a faulty state where they need to be re-interviewed to work properly. This is a real issue, and I regret moving to zwavejs2mqtt because I need a stable reliable system (this controls the heat in my house, and we have been sweating at times here, literally).

I have started to wonder if it is caused by a non-graceful startup and shutdown of the docker image. The command I use is this:

docker run -d \
    -p 8091:8091 \
    -p 3010:3000 \
    --device=/dev/ttyACM0 \
    -e TZ=Europe/Oslo \
    --privileged \
    --name zwavejs \
    --restart=unless-stopped \
    -v /var/lib/zwavejs/store:/usr/src/app/store \
    zwavejs/zwavejs2mqtt:latest

I am using “-d” because I don’t want an interactive mode, while I see others use “-it” and “-rm”. I also need it to restart on reboot?

I had this issue a few times after I first moved over a few months back, but not in awhile. I’m not entirely sure what the issue is or was, but here is my docker compose entry if it helps?

  zwavejs:
    image: zwavejs/zwavejs2mqtt:latest
    container_name: zwavejs
    security_opt:
      - seccomp:unconfined
    devices:
      - ${ZWAVEPATH}
    tty: true
    stop_signal: SIGINT
    volumes:
      - ${DOCKERDIR}/zwavejs:/usr/src/app/store
      - /etc/localtime:/etc/localtime:ro
    ports:
      - 8091:8091
      - 3000:3000
    networks:
      - docker_apps
    restart: unless-stopped

My device path is the same as yours, I’m just using a .env file for some things.
I also use “docker-compose up -d” when manually starting containers.

Thanks. It looks like I am missing the stop_signal, perhaps that is the reason? Some kind of non-graceful shutdown?

Honestly dont know. Just copied it from the ZWaveJS site.

Does /var/lib/zwavejs/store exist on your server? The problem you describe could be a result of losing the cache files every time you are restarting. Keep an eye on following files in that directory. {homeid} will be a hexadecimal number unique to your zwave stick.

{homeid}.json
{homeid}.metadata.jsonl
{homeid}.values.jsonl

Which zwavejs2mqtt version do you have? The newer versions of zwavejs doesn’t attempt to re-interview every node on every restart while the older versions (before march) did.

/var/lib/zwavejs/store exists - in fact - I moved from Docker containers to be able to easily backup the workspace.

The files mentioned are there.

I am on zwavejs2mqtt 3.4.0 (updated yesterday) and home assistant 2021.4.5. I have now re-labeled my entities for the forth time (starting over by clearing /var/lib/zwavejs). Hopefully it now does not happen again.

I’m also having this issue using the supervisor zwave js add-on in HassOS. My host crashed last night, and when I rebooted all my zwave devices needed to be re-interviewed. This is the third time it’s happened; is there any way I can avoid this in the future?