Z-wave network unavailable on restart

TLDR: how do I get HA to re-establish z-wave values via mqtt on restart without having to restart zwave2mqtt network? This used to work a few major versions of HA ago.

I run zwave2mqtt -> mosquitto mqtt -> home assistant all in docker on top of an Arch LTS host.

A few major versions of HA ago this was all working fine so that if I had to restart HA for some reason (change of config, new image etc) then when it came back up the z-wave network was all present and correct. This is important as I primarily use a number of z-wave devices as a security system.

Now however if I just restart home assistant, I then have to follow this up with a restart of zwave2mqtt to get the z-wave network back up and running. I’m pretty sure this is a recent (~6 month) change, but I’m only now getting around to addressing it.

I’ve tried adding in a custom component (monitor docker) so that I can add a switch to lovelace to restart zwave2mqtt if I’m away from home and something goes wrong. But I’ve found this custom component to be unreliable - plus it’s a sticking plaster and not a proper solution.

Below are the relevant bits of my docker compose, and configuration yaml, suspect I can do something with mosquitto so that the last values are read back in on restart?

docker-compose

  mosquitto:
    container_name: mosquitto
    image: eclipse-mosquitto:latest
    restart: always
    environment:
    - TZ=Europe/London
    - UID=1000
    - GID=1000
    - UMASK=022    
    volumes:
      - /mnt/btrfs_raid/docker/mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf
      - /mnt/btrfs_raid/docker/mosquitto/data:/mosquitto/data
      - /mnt/btrfs_raid/docker/mosquitto/log:/mosquitto/log
    ports:
      - 1883:1883
      - 9001:9001

  zwave2mqtt:
    container_name: zwave2mqtt
    image: robertslando/zwave2mqtt:latest
    restart: always
    tty: true
    stop_signal: SIGINT
    environment:
    - TZ=Europe/London
    - UID=1000
    - GID=1000    
    networks:
      - zwave
    devices:
      - /dev/ttyACM0:/dev/ttyACM0
    volumes:
      - /mnt/btrfs_raid/docker/zwave2mqtt/store:/usr/src/app/store
    ports:
      - 8091:8091

  homeassistant:
    container_name: homeassistant
    image: homeassistant/home-assistant:stable
    volumes:
      - /mnt/btrfs_raid/docker/home-assistant:/config
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - TZ=Europe/London
    restart: always
    network_mode: host
    dns:
      - 1.1.1.2
      - 9.9.9.9
    depends_on:
      - mosquitto
      - zwave2mqtt

configuration.yaml (relevant bits)

mqtt:
  broker: 192.168.1.9
  discovery: true
  discovery_prefix: homeassistant
  birth_message:
    topic: 'hass/status'
    payload: 'online'
  will_message:
    topic: 'hass/status'
    payload: 'offline'

I’ve fixed a mosquitto issue I had where persistent data wasn’t writing to disk but the issue in HA still exists.

On HA restart/recreate all my z-wave sensors are unavailable and zwave2mqtt also needs restarting. This is a pain when I’m at home and a major flaw if I’m away from home.

I appear to have fixed the issue by removing the mqtt portion of my configuration yaml and configuring mqtt via integrations instead. Now my z-wave sensors come back up within a few sec of restarting home assistant and I can remove monitor docker as well, great!

1 Like