Z-Wave JS UI: Unable to resolve localhost

Hello everyone,

I just suffered a power outage spanning 2+ days. When everything came up, Home Assistant failed to connect to Z-Wave JS UI running in a Docker container (as is Home Assistant).

I’ve already reloaded, restarted the containers, pulled the latest images, and restarted the entire Raspberry Pi 4 (running Alpine Linux) multiple times.

Z-Wave JS UI is running and reachable as well, all the sensors show up as usual.

The error I’m seeing in Home Assistant is localhost:3000 ssl:default [Name does not resolve] and the strange part is that I can access localhost:3000 from the host itself reaching the Z-Wave JS UI Docker container.

Is there something that would cause Home Assistant to be unable to resolve localhost? Never in my life have I seen anything be unable to resolve localhost (considering it’s just the loopback right?).


Are you running home assistant in host networking mode? If so, there shouldn’t be any isolation between home assistant and the host.

What’s the compose/ run command you are using to install both home assistant and zwavejsui? Also what os is docker on?

If the other suggestions fail to resolve the issue then you could always change “localhost:3000” to the actual IP of the machine running the zwavejsui docker container.

I think that’s what I would do (and I actually do) anyway so there is no vagueness in the connection

For Home Assistant, it’s a simple command:

docker run -d \
  --name homeassistant \
  --privileged \
  --restart=unless-stopped \
  -e TZ=America/Los_Angeles \
  -v /var/lib/docker/volumes/homeassistant_config/_data:/config \
  --network=host \

And for Z-Wave JS UI it’s docker-compose.yml:

version: '3.7'
    container_name: zwave-js-ui
    image: zwavejs/zwave-js-ui:latest
    restart: always
    tty: true
    stop_signal: SIGINT
      - SESSION_SECRET=mysupersecretkey
      - ZWAVEJS_EXTERNAL_CONFIG=/usr/src/app/store/.config-db
      # For logs
      - TZ=America/Los_Angeles
      - zwave
      # 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-Silicon_Labs_CP2102N_USB_to_UART_Bridge_Controller_fe4e22775194eb11a66f3a703d98b6d1-if00-port0:/dev/zwave'
      - zwave-config:/usr/src/app/store
      - '8091:8091' # port for web interface
      - '3000:3000' # port for Z-Wave JS websocket server
    name: zwave-config

The /dev device does indeed exist and all the sensors appear and show the correct state in Z-Wave JS UI.

Just noticed this was never changed but I guess let’s ignore that for now. :joy:

That kind of makes sense but since it’s just localhost, do I want to route traffic out to my LAN and then back into the host?

No, but why make it do a DNS lookup at all? It’s just - give it the localhost IP and it skips getting DNS involved at all. Additionally - if you are using the local IP address of the machine, it wouldn’t go out on to the LAN and back in to the host, because the host knows it’s own IP address.

How can I change it from localhost to from Home Assistant? It doesn’t give me an option to configure it because it’s not working. It shows this:

Additionally “System Options” doesn’t show anything relevant:

I would backup your config/volume. Then delete the zwavejs integration. When you re-add it, you can specify the path at that point. If you changed any entity names at all from Homeassistant and not in zwavejsui the names will need to be changed again. If deleting really messes anything up you can restore the backup.

Your docker settings are pretty much the same as mine so I don’t see any issues there. I would think something just got corrupt during the power outage and hopefully re-adding the integration will work.

localhost or is ideal because if your router goes offline you should still maintain connection between Homeassistant and zwavejs on the machine, so at least your zwave automations would still work. If localhost still doesn’t work, I would spell out the IP to at least get back up and running, and then try and figure out what’s going wrong. If that doesn’t work, I would suspect some other dns issue in docker or on the host (not in home assistant). You might need to delete the zwave network in docker and re-add it. If you run portainer it would be easy to delete and remove the network, and it would get recreated next time you start the container.

Simply deleting the integration and then readding it - shouldn’t change any entities because they all have unique IDs which I assume are based on the ZWave nodes.

If you don’t want to go down the remove and readd route, then shut home assistant down and find the the integration config in the hidden .storage directory, find localhost and change it to the IP address and then start homeassistant

To reconfigure the integration:

  1. Go to Settings → Devices & Services
  2. + Add Integration → Z-Wave (select Z-Wave again possibly, until you get the URL prompt)
  3. Enter the updated URL and Submit

If it says “Device is already configured”, that means you successfully re-configured the integration. It does not add a second one. If it still cannot connect, it means something’s wrong with Z-Wave JS UI. Make sure the Websocket server is still enabled in its settings.

If you remove the integration and re-add it, you will lose all entity and device customization. Any automations using Device IDs (e.g. device triggers/conditions/actions) will be broken, as those are randomly generated and unique.

1 Like

I followed your advice and I can’t connect at either.

Out of desperation I docker exec'd into the Home Assistant container and tried connecting to both http://localhost:3000 and; I get a response on both.

So I’ve no idea how I got this resolved but after simply deleting the Z-Wave JS UI container, pulling an updated image, running it and restarting Home Assistant (via its UI), magically your suggestion of using works.

Thanks and cheers!